Gatherer
Gatherer:
object
Defined in: src/stream/Gatherers.ts:14
Factories for Gatherer and the default* sentinels. The stateless overloads use a null state.
ofSequential(a, b) is resolved at runtime: a function declaring no parameters (and not marked greedy) is read as an initializer, so that call means ofSequential(initializer, integrator); otherwise it means ofSequential(integrator, finisher). An integrator that declares no parameters must use another overload.
Type Declaration
Section titled “Type Declaration”of: {<
T,R>(integrator):DefinedGatherer<T,null,R>; <T,R>(integrator,finisher):DefinedGatherer<T,null,R>; <T,A,R>(initializer,integrator,combiner,finisher):DefinedGatherer<T,A,R>; }
Returns a parallel-capable gatherer: of(integrator) and of(integrator, finisher) are stateless;
of(initializer, integrator, combiner, finisher) has state that combiner must merge correctly. Evaluation is
sequential either way, so this only declares that the gatherer is parallel-safe.
Call Signature
Section titled “Call Signature”<
T,R>(integrator):DefinedGatherer<T,null,R>
Type Parameters
Section titled “Type Parameters”T
R
Parameters
Section titled “Parameters”integrator
Section titled “integrator”Integrator<null, T, R>
Returns
Section titled “Returns”DefinedGatherer<T, null, R>
Call Signature
Section titled “Call Signature”<
T,R>(integrator,finisher):DefinedGatherer<T,null,R>
Type Parameters
Section titled “Type Parameters”T
R
Parameters
Section titled “Parameters”integrator
Section titled “integrator”Integrator<null, T, R>
finisher
Section titled “finisher”Finisher<null, R>
Returns
Section titled “Returns”DefinedGatherer<T, null, R>
Call Signature
Section titled “Call Signature”<
T,A,R>(initializer,integrator,combiner,finisher):DefinedGatherer<T,A,R>
Type Parameters
Section titled “Type Parameters”T
A
R
Parameters
Section titled “Parameters”initializer
Section titled “initializer”Initializer<A>
integrator
Section titled “integrator”Integrator<A, T, R>
combiner
Section titled “combiner”Combiner<A>
finisher
Section titled “finisher”Finisher<A, R>
Returns
Section titled “Returns”DefinedGatherer<T, A, R>
Throws
Section titled “Throws”NullPointerException if any argument is null
ofSequential
Section titled “ofSequential”ofSequential: {<
T,R>(integrator):DefinedGatherer<T,null,R>; <T,A,R>(initializer,integrator):DefinedGatherer<T,A,R>; <T,R>(integrator,finisher):DefinedGatherer<T,null,R>; <T,A,R>(initializer,integrator,finisher):DefinedGatherer<T,A,R>; }
Returns a sequential-only gatherer (default combiner): (integrator), (initializer, integrator),
(integrator, finisher) or (initializer, integrator, finisher). The two-argument forms are told apart at run
time by the first function’s declared parameter count: with none (and not greedy) it is the initializer.
Call Signature
Section titled “Call Signature”<
T,R>(integrator):DefinedGatherer<T,null,R>
Type Parameters
Section titled “Type Parameters”T
R
Parameters
Section titled “Parameters”integrator
Section titled “integrator”Integrator<null, T, R>
Returns
Section titled “Returns”DefinedGatherer<T, null, R>
Call Signature
Section titled “Call Signature”<
T,A,R>(initializer,integrator):DefinedGatherer<T,A,R>
Type Parameters
Section titled “Type Parameters”T
A
R
Parameters
Section titled “Parameters”initializer
Section titled “initializer”Initializer<A>
integrator
Section titled “integrator”Integrator<A, T, R>
Returns
Section titled “Returns”DefinedGatherer<T, A, R>
Call Signature
Section titled “Call Signature”<
T,R>(integrator,finisher):DefinedGatherer<T,null,R>
Type Parameters
Section titled “Type Parameters”T
R
Parameters
Section titled “Parameters”integrator
Section titled “integrator”Integrator<null, T, R>
finisher
Section titled “finisher”Finisher<null, R>
Returns
Section titled “Returns”DefinedGatherer<T, null, R>
Call Signature
Section titled “Call Signature”<
T,A,R>(initializer,integrator,finisher):DefinedGatherer<T,A,R>
Type Parameters
Section titled “Type Parameters”T
A
R
Parameters
Section titled “Parameters”initializer
Section titled “initializer”Initializer<A>
integrator
Section titled “integrator”Integrator<A, T, R>
finisher
Section titled “finisher”Finisher<A, R>
Returns
Section titled “Returns”DefinedGatherer<T, A, R>
Throws
Section titled “Throws”NullPointerException if any argument is null
defaultCombiner()
Section titled “defaultCombiner()”defaultCombiner<
A>():Combiner<A>
Returns the default combiner: the same instance on every call; it marks a gatherer sequential-only. Calling it throws UnsupportedOperationException.
Type Parameters
Section titled “Type Parameters”A
Returns
Section titled “Returns”Combiner<A>
defaultFinisher()
Section titled “defaultFinisher()”defaultFinisher<
A,R>():Finisher<A,R>
Returns the default finisher: the same instance on every call; it marks a gatherer as having no finishing action. Calling it does nothing.
Type Parameters
Section titled “Type Parameters”A
R
Returns
Section titled “Returns”Finisher<A, R>
defaultInitializer()
Section titled “defaultInitializer()”defaultInitializer<
A>():Initializer<A>
Returns the default initializer: the same instance on every call; it marks a gatherer stateless. Calling it returns null.
Type Parameters
Section titled “Type Parameters”A
Returns
Section titled “Returns”Initializer<A>