Stream Gatherers
summary
Stream gatherers, now in JDK 24 via the JEPs mentioned, let you implement real intermediate operations by supplying an initializer integrator finisher trio so you can create map, filter, limit/skip, indexed streams, a flexible distinctBy, sliding-window and grouped operations that the Stream API lacked. Demos show a working indexed counter, a distinct-last implemented with a finisher, sliding-window with remainder handled in finisher, and a mapConcurrent option; implementations must check the downstream push boolean to support short‑circuiting and parallel use.
AI-written summary · about
chapters (30)
- 0:00Introduction to Stream Gatherers
- 1:38JDK releases and JEP 461
- 2:39Stream operations recap
- 4:25Thinking experiment without operations
- 5:26Basic Stream Gatherer implementation
- 7:11Simple gatherer example
- 8:15Implementing a mapper gatherer
- 8:57Mapping objects with gatherers
- 9:40Filtering with gatherers
- 11:04Stateless vs stateful gatherers
- 11:25Stateful operations with gatherers
- 13:52Implementing limit and skip
- 14:14Take while and drop while
- 17:07Creating an indexed stream
- 19:40Custom index implementations
- 21:02Distinct operation with gatherers
- 23:33Finisher in gatherers
- 24:57Distinct last implementation
- 26:03Distinct by classifier
- 27:06Sliding window statistics
- 30:58Fixed window size handling
- 32:42Finisher for incomplete windows
- 33:44Execution frequency of gatherers
- 35:13Downstream rejection handling
- 37:43Checking downstream signals
- 38:47Map concurrent gatherer
- 40:13Scan and fold operations
- 41:17Windowed operations in JDK
- 42:21Parallel stream gatherers
- 43:25Q&A session
related talks
43mStream Gatherers - Deep Dive with the Expert
40mStream Gathers - The biggest change to Java Streams since 10 years
44mLevel Up Your Java Streams with Gatherers
46mJEP 461: Breathing New Life into Java Stream API
52mThe Gatherer API: the tool that was missing in the Stream API
45mHunting with Stream Gatherers
51mHunting with Stream Gatherers
48mWe Are All Gathered — We Are All to Gather
