Good point. List.of() is more optimised for this scenario since it provides an immutable list. Thanks for the feedback. Although Arrays.asList() provides a fixed size list, you can still replace an element in an existing index with another one using set operation
Thanks Patrick for answering. Building Gatherers with generics will allow us to use the same gatherer for other types. For example we can use the same fixed window gatherer for list of Person objects instead of String.
Why not List.of(...) to create a List? you are working with streams
Good point. List.of() is more optimised for this scenario since it provides an immutable list. Thanks for the feedback. Although Arrays.asList() provides a fixed size list, you can still replace an element in an existing index with another one using set operation
Why use generic T instead of String?
To make it generic, so you can use an type of list in future
Thanks Patrick for answering. Building Gatherers with generics will allow us to use the same gatherer for other types. For example we can use the same fixed window gatherer for list of Person objects instead of String.