Interface CombinerAggregator<T,A,R>
-
- All Superinterfaces:
Operation
,Serializable
public interface CombinerAggregator<T,A,R> extends Operation
Interface for aggregating values.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description A
apply(A accumulator, T value)
Updates the accumulator by applying the current accumulator with the value.A
init()
The initial value of the accumulator to start with.A
merge(A accum1, A accum2)
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.R
result(A accum)
Produces a result value out of the accumulator.
-
-
-
Method Detail
-
of
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.- 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
A apply(A accumulator, T value)
Updates the accumulator by applying the current accumulator with the value.- Parameters:
accumulator
- the current accumulatorvalue
- the value- Returns:
- the updated accumulator
-
merge
A merge(A accum1, A accum2)
Merges two accumulators and returns the merged accumulator.- Parameters:
accum1
- the first accumulatoraccum2
- the second accumulator- Returns:
- the merged accumulator
-
-