Why not List.of(...) to create a List? you are working with streams
@Code.Wizzard7 ай бұрын
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
@nayrban21877 ай бұрын
Why use generic T instead of String?
@PatrickUdochukwu7 ай бұрын
To make it generic, so you can use an type of list in future
@Code.Wizzard7 ай бұрын
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.