Hunting with Stream Gatherers
summary
Java 24 adds Stream Gatherers as a single intermediate operation called Stream Gatherers that replaces hacks like custom collectors or ugly record-equals tricks and lets code inspect state, emit zero-to-N elements, short-circuit and run concurrently. The talk shows an integrator/supplier/combiner/finisher API, demos unique-by-length, fold/scan, fixed and sliding windows, an n‑gram gatherer implemented in a few dozen lines, and uses mapConcurrent with virtual threads to turn a 9s ForkJoin parallel run into ~1s for 100 IO-bound tasks.
AI-written summary · about
