We Are All Gathered — We Are All to Gather
summary
Java 22 adds a preview gather() operation and a Gatherer API for writing custom intermediate Stream operations (both stateless and stateful, short‑circuitable, and usable in parallel or forced sequential). The talk demonstrates reimplementing filter, takeWhile, limit and window/grouping by providing initializer/combiner/finisher and downstream push semantics, and presents JMH benchmarks on 100,000 strings comparing map (481 ms) to a gather‑based map (552 ms). It also explains current limitations: no primitive specialization, lack of propagation of stream characteristics, and cases where parallel execution and optimizations fail.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 1:24Java streams explained
- 4:15Gazers principle
- 8:10Integrator interface details
- 13:08Filter example
- 18:30Short-circuiting and optimizations
- 21:20takeWhile implementation
- 24:56Stateful limits and combiner
- 27:04Grouping elements
- 33:22Parallel vs sequential
- 34:25Key functions summary
- 37:41JMH performance tests
- 41:12Typing issues and optimizations
- 44:07map vs reduce comparison
- 46:34Primitive type specialization
- 47:20Conclusion and call to action
related talks
40mStream Gathers - The biggest change to Java Streams since 10 years
43mStream Gatherers - Deep Dive with the Expert
46mJEP 461: Breathing New Life into Java Stream API
51mHunting with Stream Gatherers
52mThe Gatherer API: the tool that was missing in the Stream API
44mLevel Up Your Java Streams with Gatherers
45mHunting with Stream Gatherers
45mStream Gatherers
