Gatherer.Integrator
public
static
interface
Gatherer.Integrator
java.util.stream.Gatherer.Integrator<A, T, R> |
An Integrator receives elements and processes them, optionally using the supplied state, and optionally sends incremental results downstream.
Summary
Nested classes | |
---|---|
interface |
Gatherer.Integrator.Greedy<A, T, R>
Greedy Integrators consume all their input, and may only relay that the downstream does not want more elements. |
Public methods | |
---|---|
abstract
boolean
|
integrate(A state, T element, Downstream<? super R> downstream)
Performs an action given: the current state, the next element, and a downstream object; potentially inspecting and/or updating the state, optionally sending any number of elements downstream -- and then returns whether more elements are to be consumed or not. |
static
<A, T, R>
Integrator<A, T, R>
|
of(Integrator<A, T, R> integrator)
Factory method for turning Integrator-shaped lambdas into Integrators. |
static
<A, T, R>
Greedy<A, T, R>
|
ofGreedy(Greedy<A, T, R> greedy)
Factory method for turning Integrator-shaped lambdas into
|
Public methods
integrate
public abstract boolean integrate (A state, T element, Downstream<? super R> downstream)
Performs an action given: the current state, the next element, and a downstream object; potentially inspecting and/or updating the state, optionally sending any number of elements downstream -- and then returns whether more elements are to be consumed or not.
Parameters | |
---|---|
state |
A : The state to integrate into |
element |
T : The element to integrate |
downstream |
Downstream : The downstream object of this integration |
Returns | |
---|---|
boolean |
true if subsequent integration is desired,
false if not |
of
public static Integrator<A, T, R> of (Integrator<A, T, R> integrator)
Factory method for turning Integrator-shaped lambdas into Integrators.
Parameters | |
---|---|
integrator |
Integrator : a lambda to create as Integrator |
Returns | |
---|---|
Integrator<A, T, R> |
the given lambda as an Integrator |
ofGreedy
public static Greedy<A, T, R> ofGreedy (Greedy<A, T, R> greedy)
Factory method for turning Integrator-shaped lambdas into
Greedy
Integrators.
Parameters | |
---|---|
greedy |
Greedy : a lambda to create as Integrator.Greedy |
Returns | |
---|---|
Greedy<A, T, R> |
the given lambda as a Greedy Integrator |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.