Interface MergingCollector<T,A,R>
- Type Parameters:
T- the type of input elements to the reduction operationA- the mutable accumulation type of the reduction operation (often hidden as an implementation detail)R- the result type of the reduction operation
- All Superinterfaces:
Collector<T,A, R>
- All Known Subinterfaces:
DoubleCollector<A,R>, IntCollector<A, R>, LongCollector<A, R>
- All Known Implementing Classes:
Internals.BaseCollector, Internals.DoubleCollectorImpl, Internals.IntCollectorImpl, Internals.LongCollectorImpl, Internals.PartialCollector
A
MergingCollector is a Collector with more specific
combining algorithm. Instead of providing a combiner which can create new
partial result the MergingCollector must provide a merger which
merges the second partial result into the first one.-
Nested Class Summary
Nested classes/interfaces inherited from interface Collector
Collector.Characteristics -
Method Summary
Modifier and TypeMethodDescriptiondefault BinaryOperator<A> combiner()A function that accepts two partial results and combines them returning either existing partial result or new one.BiConsumer<A, A> merger()A function that merges the second partial result into the first partial result.Methods inherited from interface Collector
accumulator, characteristics, finisher, supplier
-
Method Details
-
merger
BiConsumer<A,A> merger()A function that merges the second partial result into the first partial result.- Returns:
- a function that merges the second partial result into the first partial result.
-
combiner
A function that accepts two partial results and combines them returning either existing partial result or new one.The default implementation calls the
merger()and returns the first partial result.
-