public interface CombinerAggregator<T,A,R> extends Operation
Interface for aggregating values.
Modifier and Type | Method and 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 a
CombinerAggregator based on initial value, accumulator and combiner. |
R |
result(A accum)
Produces a result value out of the 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 a CombinerAggregator
based on initial value, accumulator and combiner.
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 resultsT
- the value typeR
- the result typeCombinerAggregator
A init()
The initial value of the accumulator to start with.
A apply(A accumulator, T value)
Updates the accumulator by applying the current accumulator with the value.
accumulator
- the current accumulatorvalue
- the valueA merge(A accum1, A accum2)
Merges two accumulators and returns the merged accumulator.
accum1
- the first accumulatoraccum2
- the second accumulatorCopyright © 2022 The Apache Software Foundation. All rights reserved.