aggregatorOf
inline fun <IN, BUF, OUT> aggregatorOf( noinline zero: () -> BUF, noinline reduce: (b: BUF, a: IN) -> BUF, noinline merge: (b1: BUF, b2: BUF) -> BUF, noinline finish: (reduction: BUF) -> OUT, bufferEncoder: Encoder<BUF> = encoder(), outputEncoder: Encoder<OUT> = encoder()): Aggregator<IN, BUF, OUT>
Creates an Aggregator in functional manner.
Parameters
zero
A zero value for this aggregation. Should satisfy the property that any b + zero = b.
reduce
Combine two values to produce a new value. For performance, the function may modify b
and return it instead of constructing new object for b.
merge
Merge two intermediate values.
finish
Transform the output of the reduction.
bufferEncoder
Optional. Specifies the Encoder
for the intermediate value type.
outputEncoder
Optional. Specifies the Encoder
for the final output value type.