Top Description Inners Fields Constructors Methods
java.util.stream

public final Class Collectors

extends Object
Class Inheritance
Imports
java.util.AbstractMap, .AbstractSet, .ArrayList, .Collection, .Collections, .Comparator, .DoubleSummaryStatistics, .EnumSet, .HashMap, .HashSet, .IntSummaryStatistics, .Iterator, .List, .LongSummaryStatistics, .Map, .Objects, .Optional, .Set, .StringJoiner, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, java.util.function.BiConsumer, .BiFunction, .BinaryOperator, .Consumer, .Function, .Predicate, .Supplier, .ToDoubleFunction, .ToIntFunction, .ToLongFunction, jdk.internal.access.SharedSecrets

Implementations of Collector that implement various useful reduction operations, such as accumulating elements into collections, summarizing elements according to various criteria, etc.

The following are examples of using the predefined collectors to perform common mutable reduction tasks:

// Accumulate names into a List
List<String> list = people.stream()
  .map(Person::getName)
  .collect(Collectors.toList());

// Accumulate names into a TreeSet
Set<String> set = people.stream()
  .map(Person::getName)
  .collect(Collectors.toCollection(TreeSet::new));

// Convert elements to strings and concatenate them, separated by commas
String joined = things.stream()
  .map(Object::toString)
  .collect(Collectors.joining(", "));

// Compute sum of salaries of employee
int total = employees.stream()
  .collect(Collectors.summingInt(Employee::getSalary));

// Group employees by department
Map<Department, List<Employee>> byDept = employees.stream()
  .collect(Collectors.groupingBy(Employee::getDepartment));

// Compute sum of salaries by department
Map<Department, Integer> totalByDept = employees.stream()
  .collect(Collectors.groupingBy(Employee::getDepartment,
                                 Collectors.summingInt(Employee::getSalary)));

// Partition students into passing and failing
Map<Boolean, List<Student>> passingFailing = students.stream()
  .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD));

Since
1.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static record
Collectors.CollectorImpl<
the type of elements to be collected
T
, A,
the type of the result
R
>

Simple implementation class for Collector.

private static class
Collectors.Partition<T>

Implementation class used by partitioningBy.

Field Summary

Modifier and TypeField and Description
pack-priv static final Set<Collector.Characteristics>
pack-priv static final Set<Collector.Characteristics>
pack-priv static final Set<Collector.Characteristics>
pack-priv static final Set<Collector.Characteristics>
pack-priv static final Set<Collector.Characteristics>
pack-priv static final Set<Collector.Characteristics>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
the type of the input elements
T
>
Collector<T, ?, Double>

Returns:

a Collector that produces the arithmetic mean of a derived property
averagingDouble
(ToDoubleFunction<? super T>
a function extracting the property to be averaged
mapper
)

Returns a Collector that produces the arithmetic mean of a double-valued function applied to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, Double>

Returns:

a Collector that produces the arithmetic mean of a derived property
averagingInt
(ToIntFunction<? super T>
a function extracting the property to be averaged
mapper
)

Returns a Collector that produces the arithmetic mean of an integer-valued function applied to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, Double>

Returns:

a Collector that produces the arithmetic mean of a derived property
averagingLong
(ToLongFunction<? super T>
a function extracting the property to be averaged
mapper
)

Returns a Collector that produces the arithmetic mean of a long-valued function applied to the input elements.

private static <T> Supplier<T[]>
boxSupplier(T identity)

private static <I, R> Function<I, R>
public static <
the type of the input elements
T
,
intermediate accumulation type of the downstream collector
A
,
result type of the downstream collector
R
,
result type of the resulting collector
RR
>
Collector<T, A, RR>

Returns:

a collector which performs the action of the downstream collector, followed by an additional finishing step
collectingAndThen
(Collector<T, A, R>
a collector
downstream
,
Function<R, RR>
a function to be applied to the final result of the downstream collector
finisher
)

Adapts a Collector to perform an additional finishing transformation.

pack-priv static double
computeFinalSum(double[] summands)

If the compensated sum is spuriously NaN from accumulating one or more same-signed infinite values, return the correctly-signed infinity stored in the simple sum.

public static <
the type of the input elements
T
>
Collector<T, ?, Long>

Returns:

a Collector that counts the input elements
counting
()

Returns a Collector accepting elements of type T that counts the number of input elements.

private static IllegalStateException
duplicateKeyException(Object
the duplicate key
k
,
Object
1st value to be accumulated/merged
u
,
Object
2nd value to be accumulated/merged
v
)

Construct an IllegalStateException with appropriate message.

public static <
the type of the input elements
T
,
intermediate accumulation type of the downstream collector
A
,
result type of collector
R
>
Collector<T, ?, R>

Returns:

a collector which applies the predicate to the input elements and provides matching elements to the downstream collector
filtering
(Predicate<? super T>
a predicate to be applied to the input elements
predicate
,
Collector<? super T, A, R>
a collector which will accept values that match the predicate
downstream
)

Adapts a Collector to one accepting elements of the same type T by applying the predicate to each input element and only accumulating if the predicate returns true.

public static <
the type of the input elements
T
,
type of elements accepted by downstream collector
U
,
intermediate accumulation type of the downstream collector
A
,
result type of collector
R
>
Collector<T, ?, R>

Returns:

a collector which applies the mapping function to the input elements and provides the flat mapped results to the downstream collector
flatMapping
(Function<? super T, ? extends Stream<? extends U>>
a function to be applied to the input elements, which returns a stream of results
mapper
,
Collector<? super U, A, R>
a collector which will receive the elements of the stream returned by mapper
downstream
)

Adapts a Collector accepting elements of type U to one accepting elements of type T by applying a flat mapping function to each input element before accumulation.

public static <
the type of the input elements
T
,
the type of the keys
K
>
Collector<T, ?, Map<K, List<T>>>

Returns:

a Collector implementing the group-by operation
groupingBy
(Function<? super T, ? extends K>
the classifier function mapping input elements to keys
classifier
)

Returns a Collector implementing a "group by" operation on input elements of type T, grouping elements according to a classification function, and returning the results in a Map.

public static <
the type of the input elements
T
,
the type of the keys
K
,
the intermediate accumulation type of the downstream collector
A
,
the result type of the downstream reduction
D
>
Collector<T, ?, Map<K, D>>

Returns:

a Collector implementing the cascaded group-by operation
groupingBy
(Function<? super T, ? extends K>
a classifier function mapping input elements to keys
classifier
,
Collector<? super T, A, D>
a Collector implementing the downstream reduction
downstream
)

Returns a Collector implementing a cascaded "group by" operation on input elements of type T, grouping elements according to a classification function, and then performing a reduction operation on the values associated with a given key using the specified downstream Collector.

public static <
the type of the input elements
T
,
the type of the keys
K
,
the result type of the downstream reduction
D
,
the intermediate accumulation type of the downstream collector
A
,
the type of the resulting Map
M extends Map<K, D>
>
Collector<T, ?, M>

Returns:

a Collector implementing the cascaded group-by operation
groupingBy
(Function<? super T, ? extends K>
a classifier function mapping input elements to keys
classifier
,
Supplier<M>
a supplier providing a new empty Map into which the results will be inserted
mapFactory
,
Collector<? super T, A, D>
a Collector implementing the downstream reduction
downstream
)

Returns a Collector implementing a cascaded "group by" operation on input elements of type T, grouping elements according to a classification function, and then performing a reduction operation on the values associated with a given key using the specified downstream Collector.

public static <
the type of the input elements
T
,
the type of the keys
K
>
Collector<T, ?, ConcurrentMap<K, List<T>>>

Returns:

a concurrent, unordered Collector implementing the group-by operation
groupingByConcurrent
(Function<? super T, ? extends K>
a classifier function mapping input elements to keys
classifier
)

Returns a concurrent Collector implementing a "group by" operation on input elements of type T, grouping elements according to a classification function.

public static <
the type of the input elements
T
,
the type of the keys
K
,
the intermediate accumulation type of the downstream collector
A
,
the result type of the downstream reduction
D
>
Collector<T, ?, ConcurrentMap<K, D>>

Returns:

a concurrent, unordered Collector implementing the cascaded group-by operation
groupingByConcurrent
(Function<? super T, ? extends K>
a classifier function mapping input elements to keys
classifier
,
Collector<? super T, A, D>
a Collector implementing the downstream reduction
downstream
)

Returns a concurrent Collector implementing a cascaded "group by" operation on input elements of type T, grouping elements according to a classification function, and then performing a reduction operation on the values associated with a given key using the specified downstream Collector.

public static <
the type of the input elements
T
,
the type of the keys
K
,
the intermediate accumulation type of the downstream collector
A
,
the result type of the downstream reduction
D
,
the type of the resulting ConcurrentMap
M extends ConcurrentMap<K, D>
>
Collector<T, ?, M>

Returns:

a concurrent, unordered Collector implementing the cascaded group-by operation
groupingByConcurrent
(Function<? super T, ? extends K>
a classifier function mapping input elements to keys
classifier
,
Supplier<M>
a supplier providing a new empty ConcurrentMap into which the results will be inserted
mapFactory
,
Collector<? super T, A, D>
a Collector implementing the downstream reduction
downstream
)

Returns a concurrent Collector implementing a cascaded "group by" operation on input elements of type T, grouping elements according to a classification function, and then performing a reduction operation on the values associated with a given key using the specified downstream Collector.

public static Collector<CharSequence, ?, String>

Returns:

a Collector that concatenates the input elements into a String, in encounter order
joining
()

Returns a Collector that concatenates the input elements into a String, in encounter order.

public static Collector<CharSequence, ?, String>

Returns:

A Collector which concatenates CharSequence elements, separated by the specified delimiter, in encounter order
joining
(CharSequence
the delimiter to be used between each element
delimiter
)

Returns a Collector that concatenates the input elements, separated by the specified delimiter, in encounter order.

public static Collector<CharSequence, ?, String>

Returns:

A Collector which concatenates CharSequence elements, separated by the specified delimiter, in encounter order
joining
(CharSequence
the delimiter to be used between each element
delimiter
,
CharSequence
the sequence of characters to be used at the beginning of the joined result
prefix
,
CharSequence
the sequence of characters to be used at the end of the joined result
suffix
)

Returns a Collector that concatenates the input elements, separated by the specified delimiter, with the specified prefix and suffix, in encounter order.

private static <
type of the map keys
K
,
type of the map values
V
,
type of the map
M extends Map<K, V>
>
BinaryOperator<M>

Returns:

a merge function for two maps
mapMerger
(BinaryOperator<V>
A merge function suitable for Map.merge()
mergeFunction
)

BinaryOperator<Map> that merges the contents of its right argument into its left argument, using the provided merge function to handle duplicate keys.

public static <
the type of the input elements
T
,
type of elements accepted by downstream collector
U
,
intermediate accumulation type of the downstream collector
A
,
result type of collector
R
>
Collector<T, ?, R>

Returns:

a collector which applies the mapping function to the input elements and provides the mapped results to the downstream collector
mapping
(Function<? super T, ? extends U>
a function to be applied to the input elements
mapper
,
Collector<? super U, A, R>
a collector which will accept mapped values
downstream
)

Adapts a Collector accepting elements of type U to one accepting elements of type T by applying a mapping function to each input element before accumulation.

public static <
the type of the input elements
T
>
Collector<T, ?, Optional<T>>

Returns:

a Collector that produces the maximal value
maxBy
(Comparator<? super T>
a Comparator for comparing elements
comparator
)

Returns a Collector that produces the maximal element according to a given Comparator, described as an Optional<T>.

public static <
the type of the input elements
T
>
Collector<T, ?, Optional<T>>

Returns:

a Collector that produces the minimal value
minBy
(Comparator<? super T>
a Comparator for comparing elements
comparator
)

Returns a Collector that produces the minimal element according to a given Comparator, described as an Optional<T>.

public static <
the type of the input elements
T
>
Collector<T, ?, Map<Boolean, List<T>>>

Returns:

a Collector implementing the partitioning operation
partitioningBy
(Predicate<? super T>
a predicate used for classifying input elements
predicate
)

Returns a Collector which partitions the input elements according to a Predicate, and organizes them into a Map<Boolean, List<T>>.

public static <
the type of the input elements
T
,
the result type of the downstream reduction
D
,
the intermediate accumulation type of the downstream collector
A
>
Collector<T, ?, Map<Boolean, D>>

Returns:

a Collector implementing the cascaded partitioning operation
partitioningBy
(Predicate<? super T>
a predicate used for classifying input elements
predicate
,
Collector<? super T, A, D>
a Collector implementing the downstream reduction
downstream
)

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.

public static <
element type for the input and output of the reduction
T
>
Collector<T, ?, T>

Returns:

a Collector which implements the reduction operation
reducing
(T
the identity value for the reduction (also, the value that is returned when there are no input elements)
identity
,
BinaryOperator<T>
a BinaryOperator<T> used to reduce the input elements
op
)

Returns a Collector which performs a reduction of its input elements under a specified BinaryOperator using the provided identity.

public static <
element type for the input and output of the reduction
T
>
Collector<T, ?, Optional<T>>

Returns:

a Collector which implements the reduction operation
reducing
(BinaryOperator<T>
a BinaryOperator<T> used to reduce the input elements
op
)

Returns a Collector which performs a reduction of its input elements under a specified BinaryOperator.

public static <
the type of the input elements
T
,
the type of the mapped values
U
>
Collector<T, ?, U>

Returns:

a Collector implementing the map-reduce operation
reducing
(U
the identity value for the reduction (also, the value that is returned when there are no input elements)
identity
,
Function<? super T, ? extends U>
a mapping function to apply to each input value
mapper
,
BinaryOperator<U>
a BinaryOperator<U> used to reduce the mapped values
op
)

Returns a Collector which performs a reduction of its input elements under a specified mapping function and BinaryOperator.

public static <
the type of the input elements
T
>
Collector<T, ?, DoubleSummaryStatistics>

Returns:

a Collector implementing the summary-statistics reduction
summarizingDouble
(ToDoubleFunction<? super T>
a mapping function to apply to each element
mapper
)

Returns a Collector which applies an double-producing mapping function to each input element, and returns summary statistics for the resulting values.

public static <
the type of the input elements
T
>
Collector<T, ?, IntSummaryStatistics>

Returns:

a Collector implementing the summary-statistics reduction
summarizingInt
(ToIntFunction<? super T>
a mapping function to apply to each element
mapper
)

Returns a Collector which applies an int-producing mapping function to each input element, and returns summary statistics for the resulting values.

public static <
the type of the input elements
T
>
Collector<T, ?, LongSummaryStatistics>

Returns:

a Collector implementing the summary-statistics reduction
summarizingLong
(ToLongFunction<? super T>
the mapping function to apply to each element
mapper
)

Returns a Collector which applies an long-producing mapping function to each input element, and returns summary statistics for the resulting values.

public static <
the type of the input elements
T
>
Collector<T, ?, Double>

Returns:

a Collector that produces the sum of a derived property
summingDouble
(ToDoubleFunction<? super T>
a function extracting the property to be summed
mapper
)

Returns a Collector that produces the sum of a double-valued function applied to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, Integer>

Returns:

a Collector that produces the sum of a derived property
summingInt
(ToIntFunction<? super T>
a function extracting the property to be summed
mapper
)

Returns a Collector that produces the sum of an integer-valued function applied to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, Long>

Returns:

a Collector that produces the sum of a derived property
summingLong
(ToLongFunction<? super T>
a function extracting the property to be summed
mapper
)

Returns a Collector that produces the sum of a long-valued function applied to the input elements.

pack-priv static double[]
sumWithCompensation(double[]
the high-order and low-order words of the intermediate sum
intermediateSum
,
double
the name value to be included in the running sum
value
)

Incorporate a new double value using Kahan summation / compensation summation.

public static <
the type of the input elements
T
,
the result type of the first collector
R1
,
the result type of the second collector
R2
,
the final result type
R
>
Collector<T, ?, R>

Returns:

a Collector which aggregates the results of two supplied collectors.
teeing
(Collector<? super T, ?, R1>
the first downstream collector
downstream1
,
Collector<? super T, ?, R2>
the second downstream collector
downstream2
,
BiFunction<? super R1, ? super R2, R>
the function which merges two results into the single one
merger
)

Returns a Collector that is a composite of two downstream collectors.

private static <T, A1, A2, R1, R2, R> Collector<T, ?, R>
teeing0(Collector<? super T, A1, R1> downstream1, Collector<? super T, A2, R2> downstream2, BiFunction<? super R1, ? super R2, R> merger)

public static <
the type of the input elements
T
,
the type of the resulting Collection
C extends Collection<T>
>
Collector<T, ?, C>

Returns:

a Collector which collects all the input elements into a Collection, in encounter order
toCollection
(Supplier<C>
a supplier providing a new empty Collection into which the results will be inserted
collectionFactory
)

Returns a Collector that accumulates the input elements into a new Collection, in encounter order.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
>
Collector<T, ?, ConcurrentMap<K, U>>

Returns:

a concurrent, unordered Collector which collects elements into a ConcurrentMap whose keys are the result of applying a key mapping function to the input elements, and whose values are the result of applying a value mapping function to the input elements
toConcurrentMap
(Function<? super T, ? extends K>
the mapping function to produce keys
keyMapper
,
Function<? super T, ? extends U>
the mapping function to produce values
valueMapper
)

Returns a concurrent Collector that accumulates elements into a ConcurrentMap whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
>
Collector<T, ?, ConcurrentMap<K, U>>

Returns:

a concurrent, unordered Collector which collects elements into a ConcurrentMap whose keys are the result of applying a key mapping function to the input elements, and whose values are the result of applying a value mapping function to all input elements equal to the key and combining them using the merge function
toConcurrentMap
(Function<? super T, ? extends K>
a mapping function to produce keys
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values
valueMapper
,
BinaryOperator<U>
a merge function, used to resolve collisions between values associated with the same key, as supplied to Map#merge(Object, Object, BiFunction)
mergeFunction
)

Returns a concurrent Collector that accumulates elements into a ConcurrentMap whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
,
the type of the resulting ConcurrentMap
M extends ConcurrentMap<K, U>
>
Collector<T, ?, M>

Returns:

a concurrent, unordered Collector which collects elements into a ConcurrentMap whose keys are the result of applying a key mapping function to the input elements, and whose values are the result of applying a value mapping function to all input elements equal to the key and combining them using the merge function
toConcurrentMap
(Function<? super T, ? extends K>
a mapping function to produce keys
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values
valueMapper
,
BinaryOperator<U>
a merge function, used to resolve collisions between values associated with the same key, as supplied to Map#merge(Object, Object, BiFunction)
mergeFunction
,
Supplier<M>
a supplier providing a new empty ConcurrentMap into which the results will be inserted
mapFactory
)

Returns a concurrent Collector that accumulates elements into a ConcurrentMap whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, List<T>>

Returns:

a Collector which collects all the input elements into a List, in encounter order
toList
()

Returns a Collector that accumulates the input elements into a new List.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
>
Collector<T, ?, Map<K, U>>

Returns:

a Collector which collects elements into a Map whose keys and values are the result of applying mapping functions to the input elements
toMap
(Function<? super T, ? extends K>
a mapping function to produce keys
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values
valueMapper
)

Returns a Collector that accumulates elements into a Map whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
>
Collector<T, ?, Map<K, U>>

Returns:

a Collector which collects elements into a Map whose keys are the result of applying a key mapping function to the input elements, and whose values are the result of applying a value mapping function to all input elements equal to the key and combining them using the merge function
toMap
(Function<? super T, ? extends K>
a mapping function to produce keys
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values
valueMapper
,
BinaryOperator<U>
a merge function, used to resolve collisions between values associated with the same key, as supplied to Map#merge(Object, Object, BiFunction)
mergeFunction
)

Returns a Collector that accumulates elements into a Map whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
,
the type of the resulting Map
M extends Map<K, U>
>
Collector<T, ?, M>

Returns:

a Collector which collects elements into a Map whose keys are the result of applying a key mapping function to the input elements, and whose values are the result of applying a value mapping function to all input elements equal to the key and combining them using the merge function
toMap
(Function<? super T, ? extends K>
a mapping function to produce keys
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values
valueMapper
,
BinaryOperator<U>
a merge function, used to resolve collisions between values associated with the same key, as supplied to Map#merge(Object, Object, BiFunction)
mergeFunction
,
Supplier<M>
a supplier providing a new empty Map into which the results will be inserted
mapFactory
)

Returns a Collector that accumulates elements into a Map whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, Set<T>>

Returns:

a Collector which collects all the input elements into a Set
toSet
()

Returns a Collector that accumulates the input elements into a new Set.

public static <
the type of the input elements
T
>
Collector<T, ?, List<T>>

Returns:

a Collector that accumulates the input elements into an unmodifiable List in encounter order
toUnmodifiableList
()

Returns a Collector that accumulates the input elements into an unmodifiable List in encounter order.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
>
Collector<T, ?, Map<K, U>>

Returns:

a Collector that accumulates the input elements into an unmodifiable Map, whose keys and values are the result of applying the provided mapping functions to the input elements
toUnmodifiableMap
(Function<? super T, ? extends K>
a mapping function to produce keys, must be non-null
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values, must be non-null
valueMapper
)

Returns a Collector that accumulates the input elements into an unmodifiable Map, whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
,
the output type of the key mapping function
K
,
the output type of the value mapping function
U
>
Collector<T, ?, Map<K, U>>

Returns:

a Collector that accumulates the input elements into an unmodifiable Map, whose keys and values are the result of applying the provided mapping functions to the input elements
toUnmodifiableMap
(Function<? super T, ? extends K>
a mapping function to produce keys, must be non-null
keyMapper
,
Function<? super T, ? extends U>
a mapping function to produce values, must be non-null
valueMapper
,
BinaryOperator<U>
a merge function, used to resolve collisions between values associated with the same key, as supplied to Map#merge(Object, Object, BiFunction), must be non-null
mergeFunction
)

Returns a Collector that accumulates the input elements into an unmodifiable Map, whose keys and values are the result of applying the provided mapping functions to the input elements.

public static <
the type of the input elements
T
>
Collector<T, ?, Set<T>>

Returns:

a Collector that accumulates the input elements into an unmodifiable Set
toUnmodifiableSet
()

Returns a Collector that accumulates the input elements into an unmodifiable Set.

private static <
type of elements
T
,
type of map keys
K
,
type of map values
V
>
BiConsumer<Map<K, V>, T>

Returns:

an accumulating consumer
uniqKeysMapAccumulator
(Function<? super T, ? extends K>
a function that maps an element into a key
keyMapper
,
Function<? super T, ? extends V>
a function that maps an element into a value
valueMapper
)

BiConsumer<Map, T> that accumulates (key, value) pairs extracted from elements into the map, throwing IllegalStateException if duplicate keys are encountered.

private static <
type of the map keys
K
,
type of the map values
V
,
type of the map
M extends Map<K, V>
>
BinaryOperator<M>

Returns:

a merge function for two maps
uniqKeysMapMerger
()

BinaryOperator<Map> that merges the contents of its right argument into its left argument, throwing IllegalStateException if duplicate keys are encountered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait