Interface CombinerAggregator<T,A,R>
- All Superinterfaces:
Operation
,Serializable
Interface for aggregating values.
-
Method Summary
Modifier and TypeMethodDescriptionUpdates the accumulator by applying the current accumulator with the value.init()
The initial value of the accumulator to start with.Merges two accumulators and returns the merged accumulator.static <T,
R> CombinerAggregator<T, R, R> of
(R initialValue, BiFunction<? super R, ? super T, ? extends R> accumulator, BiFunction<? super R, ? super R, ? extends R> combiner) A static factory to create aCombinerAggregator
based on initial value, accumulator and combiner.Produces a result value out of the accumulator.
-
Method Details
-
of
static <T,R> CombinerAggregator<T,R, ofR> (R initialValue, BiFunction<? super R, ? super T, ? extends R> accumulator, BiFunction<? super R, ? super R, ? extends R> combiner) A static factory to create aCombinerAggregator
based on initial value, accumulator and combiner.- Parameters:
initialValue
- the initial value of the result to start withaccumulator
- a function that accumulates values into a partial resultcombiner
- a function that combines partially accumulated results- Returns:
- the
CombinerAggregator
-
init
A init()The initial value of the accumulator to start with.- Returns:
- the initial value of the accumulator
-
apply
Updates the accumulator by applying the current accumulator with the value.- Parameters:
accumulator
- the current accumulatorvalue
- the value- Returns:
- the updated accumulator
-
merge
Merges two accumulators and returns the merged accumulator.- Parameters:
accum1
- the first accumulatoraccum2
- the second accumulator- Returns:
- the merged accumulator
-
result
Produces a result value out of the accumulator.- Parameters:
accum
- the accumulator- Returns:
- the result
-