Level Up Your Java Streams with Gatherers
summary
Java 24/25 adds Stream Gatherers as a generic way to write custom intermediate stream operations, with five built-ins used here: window fixed (group 60-minute samples to compute hourly averages), window sliding (moving averages for smoothing), scan/fold (cumulative average vs final aggregate), and map concurrent (concurrent mapping using virtual threads while preserving input order). The demo builds a zip with index gatherer via gatherers.ofSequential with mutable state and downstream.push, explains finisher/combiner for parallel use, and shows they work lazily and with infinite streams.
AI-written summary · about
chapters (9)
- 0:00Introduction to Java streams
- 3:47Understanding stream pipelines
- 9:41Limitations and stream gatherers
- 12:13Windowing gatherers
- 17:28Aggregation with scan and fold
- 25:26Concurrent mapping
- 27:42Implementing custom gatherers
- 34:20Building a custom zip gatherer
- 39:07Conclusion and recap
related talks
39mLevel Up Your Java Streams with Gatherers
40mStream Gathers - The biggest change to Java Streams since 10 years
46mJEP 461: Breathing New Life into Java Stream API
43mStream Gatherers - Deep Dive with the Expert
45mStream Gatherers
48mWe Are All Gathered — We Are All to Gather
45mHunting with Stream Gatherers
52mThe Gatherer API: the tool that was missing in the Stream API
