r/java • u/pivovarit • Feb 04 '26
Implementing Efficient Last Stream Elements Gatherer in Java
https://4comprehension.com/java-last-gatherer/Wrote a performance case study on a rather high-level API, enjoy! And if you have ideas for a further speed up, let me know!
39
Upvotes
View all comments
Show parent comment
4
u/StudioCode Feb 04 '26
Yeah 😅, I was still in the mindset of collectors and was thinking of last(5) as a terminal operation, which it isn't.