Returns a Collector which partitions the input elements according
to a Predicate, reduces the values in each partition according to
another Collector, and organizes them into a
Map<Boolean, D> whose values are the result of the downstream
reduction.
The returned Map always contains mappings for both
false and true keys.
There are no guarantees on the type, mutability,
serializability, or thread-safety of the Map returned.
<T> | the type of the input elements | |
<A> | the intermediate accumulation type of the downstream collector | |
<D> | the result type of the downstream reduction | |
predicate | a predicate used for classifying input elements | |
downstream | a Collector implementing the downstream
reduction |
Collector implementing the cascaded partitioning
operation
partitioningBy(Predicate)
@apiNote
If a partition has no elements, its value in the result Map will be
obtained by calling the downstream collector's supplier function and then
applying the finisher function.
Diagram: Collectors