# Collectors

public final class **Collectors** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Implementations of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html` 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));

     
<br />

### Public Method Summary

|---|---|
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\> | [averagingDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#averagingDouble(java.util.function.ToDoubleFunction<?%20super%20T>))([ToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToDoubleFunction.html)\<? super T\> mapper) Returns a `Collector` that produces the arithmetic mean of a double-valued function applied to the input elements. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\> | [averagingInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#averagingInt(java.util.function.ToIntFunction<?%20super%20T>))([ToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToIntFunction.html)\<? super T\> mapper) Returns a `Collector` that produces the arithmetic mean of an integer-valued function applied to the input elements. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\> | [averagingLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#averagingLong(java.util.function.ToLongFunction<?%20super%20T>))([ToLongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToLongFunction.html)\<? super T\> mapper) Returns a `Collector` that produces the arithmetic mean of a long-valued function applied to the input elements. |
| static \<T, A, R, RR\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, A, RR\> | [collectingAndThen](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#collectingAndThen(java.util.stream.Collector<T,%20A,%20R>,%20java.util.function.Function<R,%20RR>))([Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, A, R\> downstream, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<R, RR\> finisher) Adapts a `Collector` to perform an additional finishing transformation. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> | [counting](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#counting())() Returns a `Collector` accepting elements of type `T` that counts the number of input elements. |
| static \<T, K\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>\> | [groupingBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> 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`. |
| static \<T, K, D, A, M extends [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, D\>\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\> | [groupingBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapFactory, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`. |
| static \<T, K, A, D\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, D\>\> | [groupingBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`. |
| static \<T, K, A, D\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, D\>\> | [groupingByConcurrent](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`. |
| static \<T, K\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>\> | [groupingByConcurrent](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier) Returns a concurrent `Collector` implementing a "group by" operation on input elements of type `T`, grouping elements according to a classification function. |
| static \<T, K, A, D, M extends [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, D\>\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\> | [groupingByConcurrent](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapFactory, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`. |
| static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<[CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html), ?, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [joining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#joining(java.lang.CharSequence,%20java.lang.CharSequence,%20java.lang.CharSequence))([CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) delimiter, [CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) prefix, [CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) suffix) Returns a `Collector` that concatenates the input elements, separated by the specified delimiter, with the specified prefix and suffix, in encounter order. |
| static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<[CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html), ?, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [joining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#joining(java.lang.CharSequence))([CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) delimiter) Returns a `Collector` that concatenates the input elements, separated by the specified delimiter, in encounter order. |
| static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<[CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html), ?, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [joining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#joining())() Returns a `Collector` that concatenates the input elements into a `String`, in encounter order. |
| static \<T, U, A, R\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, R\> | [mapping](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#mapping(java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.stream.Collector<?%20super%20U,%20A,%20R>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> mapper, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super U, A, R\> 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. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Optional](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html)\<T\>\> | [maxBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#maxBy(java.util.Comparator<?%20super%20T>))([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator) Returns a `Collector` that produces the maximal element according to a given `Comparator`, described as an `Optional<T>`. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Optional](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html)\<T\>\> | [minBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#minBy(java.util.Comparator<?%20super%20T>))([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator) Returns a `Collector` that produces the minimal element according to a given `Comparator`, described as an `Optional<T>`. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[Boolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Boolean.html), [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>\> | [partitioningBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#partitioningBy(java.util.function.Predicate<?%20super%20T>))([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> predicate) Returns a `Collector` which partitions the input elements according to a `Predicate`, and organizes them into a `Map<Boolean, List<T>>`. |
| static \<T, D, A\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[Boolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Boolean.html), D\>\> | [partitioningBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#partitioningBy(java.util.function.Predicate<?%20super%20T>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>))([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> predicate, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Optional](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html)\<T\>\> | [reducing](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(java.util.function.BinaryOperator<T>))([BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\> op) Returns a `Collector` which performs a reduction of its input elements under a specified `BinaryOperator`. |
| static \<T, U\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, U\> | [reducing](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(U,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>))(U identity, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> mapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> op) Returns a `Collector` which performs a reduction of its input elements under a specified mapping function and `BinaryOperator`. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, T\> | [reducing](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(T,%20java.util.function.BinaryOperator<T>))(T identity, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\> op) Returns a `Collector` which performs a reduction of its input elements under a specified `BinaryOperator` using the provided identity. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [DoubleSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html)\> | [summarizingDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingDouble(java.util.function.ToDoubleFunction<?%20super%20T>))([ToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToDoubleFunction.html)\<? super T\> mapper) Returns a `Collector` which applies an `double`-producing mapping function to each input element, and returns summary statistics for the resulting values. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [IntSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html)\> | [summarizingInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingInt(java.util.function.ToIntFunction<?%20super%20T>))([ToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToIntFunction.html)\<? super T\> mapper) Returns a `Collector` which applies an `int`-producing mapping function to each input element, and returns summary statistics for the resulting values. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [LongSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/LongSummaryStatistics.html)\> | [summarizingLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingLong(java.util.function.ToLongFunction<?%20super%20T>))([ToLongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToLongFunction.html)\<? super T\> mapper) Returns a `Collector` which applies an `long`-producing mapping function to each input element, and returns summary statistics for the resulting values. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\> | [summingDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summingDouble(java.util.function.ToDoubleFunction<?%20super%20T>))([ToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToDoubleFunction.html)\<? super T\> mapper) Returns a `Collector` that produces the sum of a double-valued function applied to the input elements. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Integer](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Integer.html)\> | [summingInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summingInt(java.util.function.ToIntFunction<?%20super%20T>))([ToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToIntFunction.html)\<? super T\> mapper) Returns a `Collector` that produces the sum of a integer-valued function applied to the input elements. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> | [summingLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summingLong(java.util.function.ToLongFunction<?%20super%20T>))([ToLongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToLongFunction.html)\<? super T\> mapper) Returns a `Collector` that produces the sum of a long-valued function applied to the input elements. |
| static \<T, C extends [Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<T\>\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, C\> | [toCollection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toCollection(java.util.function.Supplier<C>))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<C\> collectionFactory) Returns a `Collector` that accumulates the input elements into a new `Collection`, in encounter order. |
| static \<T, K, U, M extends [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, U\>\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\> | [toConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> mergeFunction, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapSupplier) 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. |
| static \<T, K, U\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, U\>\> | [toConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> 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. |
| static \<T, K, U\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, U\>\> | [toConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> 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. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\> | [toList](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toList())() Returns a `Collector` that accumulates the input elements into a new `List`. |
| static \<T, K, U\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, U\>\> | [toMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> 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. |
| static \<T, K, U, M extends [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, U\>\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\> | [toMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> mergeFunction, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapSupplier) 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. |
| static \<T, K, U\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, U\>\> | [toMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> 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. |
| static \<T\> [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<T\>\> | [toSet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toSet())() Returns a `Collector` that accumulates the input elements into a new `Set`. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Methods

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\>
**averagingDouble**
([ToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToDoubleFunction.html)\<? super T\> mapper)

Returns a `Collector` that produces the arithmetic mean of a double-valued
function applied to the input elements. If no elements are present,
the result is 0.

The average returned can vary depending upon the order in which
values are recorded, due to accumulated rounding error in
addition of values of differing magnitudes. Values sorted by increasing
absolute magnitude tend to yield more accurate results. If any recorded
value is a `NaN` or the sum is at any point a `NaN` then the
average will be `NaN`.

##### Parameters

| mapper | a function extracting the property to be summed |
|---|---|

##### Returns

- a `Collector` that produces the sum of a derived property

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\>
**averagingInt**
([ToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToIntFunction.html)\<? super T\> mapper)

Returns a `Collector` that produces the arithmetic mean of an integer-valued
function applied to the input elements. If no elements are present,
the result is 0.

##### Parameters

| mapper | a function extracting the property to be summed |
|---|---|

##### Returns

- a `Collector` that produces the sum of a derived property

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\>
**averagingLong**
([ToLongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToLongFunction.html)\<? super T\> mapper)

Returns a `Collector` that produces the arithmetic mean of a long-valued
function applied to the input elements. If no elements are present,
the result is 0.

##### Parameters

| mapper | a function extracting the property to be summed |
|---|---|

##### Returns

- a `Collector` that produces the sum of a derived property

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, A, RR\>
**collectingAndThen**
([Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, A, R\> downstream, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<R, RR\> finisher)

Adapts a `Collector` to perform an additional finishing
transformation. For example, one could adapt the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toList()`
collector to always produce an immutable list with:

    List<String> people
             = people.stream().collect(collectingAndThen(toList(), Collections::unmodifiableList));
     
<br />

##### Parameters

| downstream | a collector |
| finisher | a function to be applied to the final result of the downstream collector |
|---|---|

##### Returns

- a collector which performs the action of the downstream collector, followed by an additional finishing step

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\>
**counting**
()

Returns a `Collector` accepting elements of type `T` that
counts the number of input elements. If no elements are present, the
result is 0.

##### Returns

- a `Collector` that counts the input elements

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>\>
**groupingBy**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> 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`.

The classification function maps elements to some key type `K`.
The collector produces a `Map<K, List<T>>` whose keys are the
values resulting from applying the classification function to the input
elements, and whose corresponding values are `List`s containing the
input elements which map to the associated key under the classification
function.

There are no guarantees on the type, mutability, serializability, or
thread-safety of the `Map` or `List` objects returned.

##### Parameters

| classifier | the classifier function mapping input elements to keys |
|---|---|

##### Returns

- a `Collector` implementing the group-by operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\>
**groupingBy**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapFactory, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`. The `Map` produced by the Collector is created
with the supplied factory function.

The classification function maps elements to some key type `K`.
The downstream collector operates on elements of type `T` and
produces a result of type `D`. The resulting collector produces a
`Map<K, D>`.

For example, to compute the set of last names of people in each city,
where the city names are sorted:

    Map<City, Set<String>> namesByCity
             = people.stream().collect(groupingBy(Person::getCity, TreeMap::new,
                                                  mapping(Person::getLastName, toSet())));
     
<br />

##### Parameters

| classifier | a classifier function mapping input elements to keys |
| mapFactory | a function which, when called, produces a new empty `Map` of the desired type |
| downstream | a `Collector` implementing the downstream reduction |
|---|---|

##### Returns

- a `Collector` implementing the cascaded group-by operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, D\>\>
**groupingBy**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`.

The classification function maps elements to some key type `K`.
The downstream collector operates on elements of type `T` and
produces a result of type `D`. The resulting collector produces a
`Map<K, D>`.

There are no guarantees on the type, mutability,
serializability, or thread-safety of the `Map` returned.

For example, to compute the set of last names of people in each city:

    Map<City, Set<String>> namesByCity
             = people.stream().collect(groupingBy(Person::getCity,
                                                  mapping(Person::getLastName, toSet())));
     
<br />

##### Parameters

| classifier | a classifier function mapping input elements to keys |
| downstream | a `Collector` implementing the downstream reduction |
|---|---|

##### Returns

- a `Collector` implementing the cascaded group-by operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, D\>\>
**groupingByConcurrent**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`.

This is a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#CONCURRENT` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#UNORDERED` Collector.

The classification function maps elements to some key type `K`.
The downstream collector operates on elements of type `T` and
produces a result of type `D`. The resulting collector produces a
`Map<K, D>`.

For example, to compute the set of last names of people in each city,
where the city names are sorted:

    ConcurrentMap<City, Set<String>> namesByCity
             = people.stream().collect(groupingByConcurrent(Person::getCity,
                                                            mapping(Person::getLastName, toSet())));
     
<br />

##### Parameters

| classifier | a classifier function mapping input elements to keys |
| downstream | a `Collector` implementing the downstream reduction |
|---|---|

##### Returns

- a concurrent, unordered `Collector` implementing the cascaded group-by operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>\>
**groupingByConcurrent**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier)

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

This is a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#CONCURRENT` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#UNORDERED` Collector.

The classification function maps elements to some key type `K`.
The collector produces a `ConcurrentMap<K, List<T>>` whose keys are the
values resulting from applying the classification function to the input
elements, and whose corresponding values are `List`s containing the
input elements which map to the associated key under the classification
function.

There are no guarantees on the type, mutability, or serializability
of the `Map` or `List` objects returned, or of the
thread-safety of the `List` objects returned.

##### Parameters

| classifier | a classifier function mapping input elements to keys |
|---|---|

##### Returns

- a concurrent, unordered `Collector` implementing the group-by operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\>
**groupingByConcurrent**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> classifier, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapFactory, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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`. The `ConcurrentMap` produced by the
Collector is created with the supplied factory function.

This is a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#CONCURRENT` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#UNORDERED` Collector.

The classification function maps elements to some key type `K`.
The downstream collector operates on elements of type `T` and
produces a result of type `D`. The resulting collector produces a
`Map<K, D>`.

For example, to compute the set of last names of people in each city,
where the city names are sorted:

    ConcurrentMap<City, Set<String>> namesByCity
             = people.stream().collect(groupingBy(Person::getCity, ConcurrentSkipListMap::new,
                                                  mapping(Person::getLastName, toSet())));
     
<br />

##### Parameters

| classifier | a classifier function mapping input elements to keys |
| mapFactory | a function which, when called, produces a new empty `ConcurrentMap` of the desired type |
| downstream | a `Collector` implementing the downstream reduction |
|---|---|

##### Returns

- a concurrent, unordered `Collector` implementing the cascaded group-by operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingByConcurrent(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#groupingBy(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Supplier<M>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<[CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html), ?, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**joining**
([CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) delimiter, [CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) prefix, [CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) suffix)

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

##### Parameters

| delimiter | the delimiter to be used between each element |
| prefix | the sequence of characters to be used at the beginning of the joined result |
| suffix | the sequence of characters to be used at the end of the joined result |
|---|---|

##### Returns

- A `Collector` which concatenates CharSequence elements, separated by the specified delimiter, in encounter order

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<[CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html), ?, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**joining**
([CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html) delimiter)

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

##### Parameters

| delimiter | the delimiter to be used between each element |
|---|---|

##### Returns

- A `Collector` which concatenates CharSequence elements, separated by the specified delimiter, in encounter order

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<[CharSequence](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CharSequence.html), ?, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**joining**
()

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

##### Returns

- a `Collector` that concatenates the input elements into a `String`, in encounter order

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, R\>
**mapping**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> mapper, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super U, A, R\> 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.

##### Parameters

| mapper | a function to be applied to the input elements |
| downstream | a collector which will accept mapped values |
|---|---|

##### Returns

- a collector which applies the mapping function to the input elements and provides the mapped results to the downstream collector

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Optional](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html)\<T\>\>
**maxBy**
([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator)

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

##### Parameters

| comparator | a `Comparator` for comparing elements |
|---|---|

##### Returns

- a `Collector` that produces the maximal value

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Optional](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html)\<T\>\>
**minBy**
([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator)

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

##### Parameters

| comparator | a `Comparator` for comparing elements |
|---|---|

##### Returns

- a `Collector` that produces the minimal value

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[Boolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Boolean.html), [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>\>
**partitioningBy**
([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> predicate)

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

There are no guarantees on the type, mutability,
serializability, or thread-safety of the `Map` returned.

##### Parameters

| predicate | a predicate used for classifying input elements |
|---|---|

##### Returns

- a `Collector` implementing the partitioning operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#partitioningBy(java.util.function.Predicate<?%20super%20T>,%20java.util.stream.Collector<?%20super%20T,%20A,%20D>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[Boolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Boolean.html), D\>\>
**partitioningBy**
([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> predicate, [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<? super T, A, D\> 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.

There are no guarantees on the type, mutability,
serializability, or thread-safety of the `Map` returned.

##### Parameters

| predicate | a predicate used for classifying input elements |
| downstream | a `Collector` implementing the downstream reduction |
|---|---|

##### Returns

- a `Collector` implementing the cascaded partitioning operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#partitioningBy(java.util.function.Predicate<?%20super%20T>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Optional](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Optional.html)\<T\>\>
**reducing**
([BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\> op)

Returns a `Collector` which performs a reduction of its
input elements under a specified `BinaryOperator`. The result
is described as an `Optional<T>`.

##### Parameters

| op | a `BinaryOperator<T>` used to reduce the input elements |
|---|---|

##### Returns

- a `Collector` which implements the reduction operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(T,%20java.util.function.BinaryOperator<T>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(U,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, U\>
**reducing**
(U identity, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> mapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> op)

Returns a `Collector` which performs a reduction of its
input elements under a specified mapping function and
`BinaryOperator`. This is a generalization of
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(T,%20java.util.function.BinaryOperator<T>)` which allows a transformation
of the elements before reduction.

##### Parameters

| identity | the identity value for the reduction (also, the value that is returned when there are no input elements) |
| mapper | a mapping function to apply to each input value |
| op | a `BinaryOperator<U>` used to reduce the mapped values |
|---|---|

##### Returns

- a `Collector` implementing the map-reduce operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(T,%20java.util.function.BinaryOperator<T>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(java.util.function.BinaryOperator<T>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, T\>
**reducing**
(T identity, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\> op)

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

##### Parameters

| identity | the identity value for the reduction (also, the value that is returned when there are no input elements) |
| op | a `BinaryOperator<T>` used to reduce the input elements |
|---|---|

##### Returns

- a `Collector` which implements the reduction operation

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(java.util.function.BinaryOperator<T>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#reducing(U,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [DoubleSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html)\>
**summarizingDouble**
([ToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToDoubleFunction.html)\<? super T\> mapper)

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

##### Parameters

| mapper | a mapping function to apply to each element |
|---|---|

##### Returns

- a `Collector` implementing the summary-statistics reduction

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingLong(java.util.function.ToLongFunction<?%20super%20T>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingInt(java.util.function.ToIntFunction<?%20super%20T>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [IntSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html)\>
**summarizingInt**
([ToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToIntFunction.html)\<? super T\> mapper)

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

##### Parameters

| mapper | a mapping function to apply to each element |
|---|---|

##### Returns

- a `Collector` implementing the summary-statistics reduction

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingDouble(java.util.function.ToDoubleFunction<?%20super%20T>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingLong(java.util.function.ToLongFunction<?%20super%20T>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [LongSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/LongSummaryStatistics.html)\>
**summarizingLong**
([ToLongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToLongFunction.html)\<? super T\> mapper)

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

##### Parameters

| mapper | the mapping function to apply to each element |
|---|---|

##### Returns

- a `Collector` implementing the summary-statistics reduction

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingDouble(java.util.function.ToDoubleFunction<?%20super%20T>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#summarizingInt(java.util.function.ToIntFunction<?%20super%20T>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Double](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html)\>
**summingDouble**
([ToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToDoubleFunction.html)\<? super T\> mapper)

Returns a `Collector` that produces the sum of a double-valued
function applied to the input elements. If no elements are present,
the result is 0.

The sum returned can vary depending upon the order in which
values are recorded, due to accumulated rounding error in
addition of values of differing magnitudes. Values sorted by increasing
absolute magnitude tend to yield more accurate results. If any recorded
value is a `NaN` or the sum is at any point a `NaN` then the
sum will be `NaN`.

##### Parameters

| mapper | a function extracting the property to be summed |
|---|---|

##### Returns

- a `Collector` that produces the sum of a derived property

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Integer](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Integer.html)\>
**summingInt**
([ToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToIntFunction.html)\<? super T\> mapper)

Returns a `Collector` that produces the sum of a integer-valued
function applied to the input elements. If no elements are present,
the result is 0.

##### Parameters

| mapper | a function extracting the property to be summed |
|---|---|

##### Returns

- a `Collector` that produces the sum of a derived property

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\>
**summingLong**
([ToLongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ToLongFunction.html)\<? super T\> mapper)

Returns a `Collector` that produces the sum of a long-valued
function applied to the input elements. If no elements are present,
the result is 0.

##### Parameters

| mapper | a function extracting the property to be summed |
|---|---|

##### Returns

- a `Collector` that produces the sum of a derived property

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, C\>
**toCollection**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<C\> collectionFactory)

Returns a `Collector` that accumulates the input elements into a
new `Collection`, in encounter order. The `Collection` is
created by the provided factory.

##### Parameters

| collectionFactory | a `Supplier` which returns a new, empty `Collection` of the appropriate type |
|---|---|

##### Returns

- a `Collector` which collects all the input elements into a `Collection`, in encounter order

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\>
**toConcurrentMap**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> mergeFunction, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapSupplier)

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.

If the mapped keys contains duplicates (according to `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`),
the value mapping function is applied to each equal element, and the
results are merged using the provided merging function. The
`ConcurrentMap` is created by a provided supplier function.

This is a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#CONCURRENT` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#UNORDERED` Collector.

##### Parameters

| keyMapper | a mapping function to produce keys |
| valueMapper | a mapping function to produce values |
| mergeFunction | a merge function, used to resolve collisions between values associated with the same key, as supplied to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html#merge(K,%20V,%20java.util.function.BiFunction<?%20super%20V,%20?%20super%20V,%20?%20extends%20V>)` |
| mapSupplier | a function which returns a new, empty `Map` into which the results will be inserted |
|---|---|

##### 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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, U\>\>
**toConcurrentMap**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> 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.

If the mapped keys contains duplicates (according to `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`),
the value mapping function is applied to each equal element, and the
results are merged using the provided merging function.

##### Parameters

| keyMapper | a mapping function to produce keys |
| valueMapper | a mapping function to produce values |
| mergeFunction | a merge function, used to resolve collisions between values associated with the same key, as supplied to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html#merge(K,%20V,%20java.util.function.BiFunction<?%20super%20V,%20?%20super%20V,%20?%20extends%20V>)` |
|---|---|

##### 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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [ConcurrentMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/ConcurrentMap.html)\<K, U\>\>
**toConcurrentMap**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> 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.

If the mapped keys contains duplicates (according to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`), an `IllegalStateException` is
thrown when the collection operation is performed. If the mapped keys
may have duplicates, use
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)` instead.

##### Parameters

| keyMapper | the mapping function to produce keys |
| valueMapper | the mapping function to produce values |
|---|---|

##### 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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<T\>\>
**toList**
()

Returns a `Collector` that accumulates the input elements into a
new `List`. There are no guarantees on the type, mutability,
serializability, or thread-safety of the `List` returned; if more
control over the returned `List` is required, use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toCollection(java.util.function.Supplier<C>)`.

##### Returns

- a `Collector` which collects all the input elements into a `List`, in encounter order

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, U\>\>
**toMap**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> 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.

If the mapped
keys contains duplicates (according to `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`),
the value mapping function is applied to each equal element, and the
results are merged using the provided merging function.

##### Parameters

| keyMapper | a mapping function to produce keys |
| valueMapper | a mapping function to produce values |
| mergeFunction | a merge function, used to resolve collisions between values associated with the same key, as supplied to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html#merge(K,%20V,%20java.util.function.BiFunction<?%20super%20V,%20?%20super%20V,%20?%20extends%20V>)` |
|---|---|

##### 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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, M\>
**toMap**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> valueMapper, [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<U\> mergeFunction, [Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<M\> mapSupplier)

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.

If the mapped
keys contains duplicates (according to `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`),
the value mapping function is applied to each equal element, and the
results are merged using the provided merging function. The `Map`
is created by a provided supplier function.

##### Parameters

| keyMapper | a mapping function to produce keys |
| valueMapper | a mapping function to produce values |
| mergeFunction | a merge function, used to resolve collisions between values associated with the same key, as supplied to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html#merge(K,%20V,%20java.util.function.BiFunction<?%20super%20V,%20?%20super%20V,%20?%20extends%20V>)` |
| mapSupplier | a function which returns a new, empty `Map` into which the results will be inserted |
|---|---|

##### 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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<K, U\>\>
**toMap**
([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends K\> keyMapper, [Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? super T, ? extends U\> 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.

If the mapped keys contains duplicates (according to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`), an `IllegalStateException` is
thrown when the collection operation is performed. If the mapped keys
may have duplicates, use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`
instead.

##### Parameters

| keyMapper | a mapping function to produce keys |
| valueMapper | a mapping function to produce values |
|---|---|

##### Returns

- a `Collector` which collects elements into a `Map` whose keys and values are the result of applying mapping functions to the input elements

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>,%20java.util.function.BinaryOperator<U>,%20java.util.function.Supplier<M>)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function<?%20super%20T,%20?%20extends%20K>,%20java.util.function.Function<?%20super%20T,%20?%20extends%20U>)`

#### public static [Collector](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.html)\<T, ?, [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<T\>\>
**toSet**
()

Returns a `Collector` that accumulates the input elements into a
new `Set`. There are no guarantees on the type, mutability,
serializability, or thread-safety of the `Set` returned; if more
control over the returned `Set` is required, use
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collectors.html#toCollection(java.util.function.Supplier<C>)`.

This is an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html#UNORDERED`
Collector.

##### Returns

- a `Collector` which collects all the input elements into a `Set`