Collectors.ToMap Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ToMap(IFunction, IFunction) |
Returns a |
ToMap(IFunction, IFunction, IBinaryOperator) |
Returns a |
ToMap(IFunction, IFunction, IBinaryOperator, ISupplier) |
Returns a |
ToMap(IFunction, IFunction)
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.
[Android.Runtime.Register("toMap", "(Ljava/util/function/Function;Ljava/util/function/Function;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "U" })]
public static Java.Util.Streams.ICollector? ToMap (Java.Util.Functions.IFunction? keyMapper, Java.Util.Functions.IFunction? valueMapper);
[<Android.Runtime.Register("toMap", "(Ljava/util/function/Function;Ljava/util/function/Function;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "U" })>]
static member ToMap : Java.Util.Functions.IFunction * Java.Util.Functions.IFunction -> Java.Util.Streams.ICollector
Parameters
- keyMapper
- IFunction
a mapping function to produce keys
- valueMapper
- IFunction
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
- Attributes
Remarks
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 contain duplicates (according to Object#equals(Object)
), an IllegalStateException
is thrown when the collection operation is performed. If the mapped keys might have duplicates, use #toMap(Function, Function, BinaryOperator)
instead.
There are no guarantees on the type, mutability, serializability, or thread-safety of the Map
returned.
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
ToMap(IFunction, IFunction, IBinaryOperator)
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.
[Android.Runtime.Register("toMap", "(Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/function/BinaryOperator;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "U" })]
public static Java.Util.Streams.ICollector? ToMap (Java.Util.Functions.IFunction? keyMapper, Java.Util.Functions.IFunction? valueMapper, Java.Util.Functions.IBinaryOperator? mergeFunction);
[<Android.Runtime.Register("toMap", "(Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/function/BinaryOperator;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "U" })>]
static member ToMap : Java.Util.Functions.IFunction * Java.Util.Functions.IFunction * Java.Util.Functions.IBinaryOperator -> Java.Util.Streams.ICollector
Parameters
- keyMapper
- IFunction
a mapping function to produce keys
- valueMapper
- IFunction
a mapping function to produce values
- mergeFunction
- IBinaryOperator
a merge function, used to resolve collisions between
values associated with the same key, as supplied
to Map#merge(Object, Object, BiFunction)
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
- Attributes
Remarks
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 contain duplicates (according to Object#equals(Object)
), the value mapping function is applied to each equal element, and the results are merged using the provided merging function.
There are no guarantees on the type, mutability, serializability, or thread-safety of the Map
returned.
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
ToMap(IFunction, IFunction, IBinaryOperator, ISupplier)
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.
[Android.Runtime.Register("toMap", "(Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/function/BinaryOperator;Ljava/util/function/Supplier;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "U", "M extends java.util.Map<K, U>" })]
public static Java.Util.Streams.ICollector? ToMap (Java.Util.Functions.IFunction? keyMapper, Java.Util.Functions.IFunction? valueMapper, Java.Util.Functions.IBinaryOperator? mergeFunction, Java.Util.Functions.ISupplier? mapFactory);
[<Android.Runtime.Register("toMap", "(Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/function/BinaryOperator;Ljava/util/function/Supplier;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "K", "U", "M extends java.util.Map<K, U>" })>]
static member ToMap : Java.Util.Functions.IFunction * Java.Util.Functions.IFunction * Java.Util.Functions.IBinaryOperator * Java.Util.Functions.ISupplier -> Java.Util.Streams.ICollector
Parameters
- keyMapper
- IFunction
a mapping function to produce keys
- valueMapper
- IFunction
a mapping function to produce values
- mergeFunction
- IBinaryOperator
a merge function, used to resolve collisions between
values associated with the same key, as supplied
to Map#merge(Object, Object, BiFunction)
- mapFactory
- ISupplier
a supplier providing 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
- Attributes
Remarks
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 contain duplicates (according to Object#equals(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.
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.