Udostępnij za pośrednictwem


Collectors.GroupingByConcurrent Method

Definition

Overloads

GroupingByConcurrent(IFunction, ICollector)

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.

GroupingByConcurrent(IFunction, ISupplier, ICollector)

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.

GroupingByConcurrent(IFunction)

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

GroupingByConcurrent(IFunction, ICollector)

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.

[Android.Runtime.Register("groupingByConcurrent", "(Ljava/util/function/Function;Ljava/util/stream/Collector;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "A", "D" })]
public static Java.Util.Streams.ICollector? GroupingByConcurrent (Java.Util.Functions.IFunction? classifier, Java.Util.Streams.ICollector? downstream);
[<Android.Runtime.Register("groupingByConcurrent", "(Ljava/util/function/Function;Ljava/util/stream/Collector;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "A", "D" })>]
static member GroupingByConcurrent : Java.Util.Functions.IFunction * Java.Util.Streams.ICollector -> Java.Util.Streams.ICollector

Parameters

classifier
IFunction

a classifier function mapping input elements to keys

downstream
ICollector

a Collector implementing the downstream reduction

Returns

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

Attributes

Remarks

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 Collector.Characteristics#CONCURRENT concurrent and Collector.Characteristics#UNORDERED 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 ConcurrentMap<K, D>.

There are no guarantees on the type, mutability, or serializability of the ConcurrentMap returned.

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

{@code
            ConcurrentMap<City, Set<String>> namesByCity
              = people.stream().collect(
                groupingByConcurrent(Person::getCity,
                                     mapping(Person::getLastName,
                                             toSet())));
            }

Java documentation for java.util.stream.Collectors.groupingByConcurrent(java.util.function.Function<? super T, ? extends K>, java.util.stream.Collector<? super T, A, D>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GroupingByConcurrent(IFunction, ISupplier, ICollector)

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.

[Android.Runtime.Register("groupingByConcurrent", "(Ljava/util/function/Function;Ljava/util/function/Supplier;Ljava/util/stream/Collector;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "A", "D", "M extends java.util.concurrent.ConcurrentMap<K, D>" })]
public static Java.Util.Streams.ICollector? GroupingByConcurrent (Java.Util.Functions.IFunction? classifier, Java.Util.Functions.ISupplier? mapFactory, Java.Util.Streams.ICollector? downstream);
[<Android.Runtime.Register("groupingByConcurrent", "(Ljava/util/function/Function;Ljava/util/function/Supplier;Ljava/util/stream/Collector;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "A", "D", "M extends java.util.concurrent.ConcurrentMap<K, D>" })>]
static member GroupingByConcurrent : Java.Util.Functions.IFunction * Java.Util.Functions.ISupplier * Java.Util.Streams.ICollector -> Java.Util.Streams.ICollector

Parameters

classifier
IFunction

a classifier function mapping input elements to keys

mapFactory
ISupplier

a supplier providing a new empty ConcurrentMap into which the results will be inserted

downstream
ICollector

a Collector implementing the downstream reduction

Returns

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

Attributes

Remarks

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 Collector.Characteristics#CONCURRENT concurrent and Collector.Characteristics#UNORDERED 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 ConcurrentMap<K, D>.

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

{@code
            ConcurrentMap<City, Set<String>> namesByCity
              = people.stream().collect(
                groupingByConcurrent(Person::getCity,
                                     ConcurrentSkipListMap::new,
                                     mapping(Person::getLastName,
                                             toSet())));
            }

Java documentation for java.util.stream.Collectors.groupingByConcurrent(java.util.function.Function<? super T, ? extends K>, java.util.function.Supplier<M>, java.util.stream.Collector<? super T, A, D>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GroupingByConcurrent(IFunction)

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

[Android.Runtime.Register("groupingByConcurrent", "(Ljava/util/function/Function;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "K" })]
public static Java.Util.Streams.ICollector? GroupingByConcurrent (Java.Util.Functions.IFunction? classifier);
[<Android.Runtime.Register("groupingByConcurrent", "(Ljava/util/function/Function;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "K" })>]
static member GroupingByConcurrent : Java.Util.Functions.IFunction -> Java.Util.Streams.ICollector

Parameters

classifier
IFunction

a classifier function mapping input elements to keys

Returns

a concurrent, unordered Collector implementing the group-by operation

Attributes

Remarks

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 Collector.Characteristics#CONCURRENT concurrent and Collector.Characteristics#UNORDERED 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 Lists 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 ConcurrentMap or List objects returned, or of the thread-safety of the List objects returned.

Java documentation for java.util.stream.Collectors.groupingByConcurrent(java.util.function.Function<? super T, ? extends K>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to