In this code: https://github.com/eugenp/tutorials/blob/5a74185fb083537a2ad7021ea214e37abadf8791/core-java-modules/core-java-streams-7/src/main/java/com/baeldung/streams/gatherer/SlidingWindowGatherer.java#L34 the size of `state` is never 3 - the `integrator` never leaves such state. The `finisher` can be removed. Also, using `ArrayList` for this task is insane: `removeFirst` needs to copy the entire array. `ArrayDeque` would be much more efficient.
In this code:
tutorials/core-java-modules/core-java-streams-7/src/main/java/com/baeldung/streams/gatherer/SlidingWindowGatherer.java
Line 34 in 5a74185
the size of
stateis never 3 - theintegratornever leaves such state. Thefinishercan be removed.Also, using
ArrayListfor this task is insane:removeFirstneeds to copy the entire array.ArrayDequewould be much more efficient.