From 1e6bfd68c004f2fe603c63062b79adafc434a0c8 Mon Sep 17 00:00:00 2001 From: Steven Gantz Date: Thu, 17 Oct 2024 19:33:23 -0400 Subject: [PATCH] Update with cleanup of gatherers page --- .../blog/java-streams-gather-Jdk-23.md | 19 ------------------- posts/jdk23-streams-gather/index.html | 17 ++--------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/astro/src/content/blog/java-streams-gather-Jdk-23.md b/astro/src/content/blog/java-streams-gather-Jdk-23.md index 22b5c0b3..58de97cf 100644 --- a/astro/src/content/blog/java-streams-gather-Jdk-23.md +++ b/astro/src/content/blog/java-streams-gather-Jdk-23.md @@ -199,46 +199,27 @@ Gatherer.ofSequential(initializer, integrator); ## Built-In Gatherers -TODO - add link to JavaDoc for each with examples! The following are built-in gatherers in the [java.util.stream.Gatherers][gatherers-javadoc] class: [fold][fold] is a stateful many-to-one gatherer which constructs an aggregate incrementally and emits that aggregate when no more input elements exist. -TODO - example - [mapConcurrent][mapConcurrent] is a stateful one-to-one gatherer which invokes a supplied function for each input element concurrently, up to a supplied limit. -TODO - example - [scan][scan] is a stateful one-to-one gatherer which applies a supplied function to the current state and the current element to produce the next element, which it passes downstream. -TODO - example - [windowFixed][windowFixed] is a stateful many-to-many gatherer which groups input elements into lists of a supplied size, emitting the windows downstream when they are full. -TODO - example - [windowSliding][windowSliding] is a stateful many-to-many gatherer which groups input elements into lists of a supplied size. After the first window, each subsequent window is created from a copy of its predecessor by dropping the first element and appending the next element from the input stream.. -TODO - example - -## Gatherers are so useful, we can re-create every intermediate stream operation - -TODO - recreate everything as gatherers - -TODO - find real life example -- distinctBy -- grouping and applying a change to the whole collection - [soby-chako]: https://github.com/sobychacko [openjdk23]: https://openjdk.org/projects/jdk/23/ [jeps473]: https://openjdk.org/jeps/473 diff --git a/posts/jdk23-streams-gather/index.html b/posts/jdk23-streams-gather/index.html index 2f09692c..a2cdcf1a 100644 --- a/posts/jdk23-streams-gather/index.html +++ b/posts/jdk23-streams-gather/index.html @@ -306,34 +306,21 @@
Examples
Gatherer.ofSequential(initializer, integrator);

Built-In Gatherers

-

TODO - add link to JavaDoc for each with examples! -The following are built-in gatherers in the java.util.stream.Gatherers class:

+

The following are built-in gatherers in the java.util.stream.Gatherers class:

fold is a stateful many-to-one gatherer which constructs an aggregate incrementally and emits that aggregate when no more input elements exist.

-

TODO - example

mapConcurrent is a stateful one-to-one gatherer which invokes a supplied function for each input element concurrently, up to a supplied limit.

-

TODO - example

scan is a stateful one-to-one gatherer which applies a supplied function to the current state and the current element to produce the next element, which it passes downstream.

-

TODO - example

windowFixed is a stateful many-to-many gatherer which groups input elements into lists of a supplied size, emitting the windows downstream when they are full.

-

TODO - example

windowSliding is a stateful many-to-many gatherer which groups input elements into lists of a supplied size. After the first window, each subsequent window is created from a copy of its predecessor by dropping -the first element and appending the next element from the input stream..

-

TODO - example

-

Gatherers are so useful, we can re-create every intermediate stream operation

-

TODO - recreate everything as gatherers

-

TODO - find real life example

-