W3cubDocs

/Kotlin

toMap

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V> Iterable<Pair<K, V>>.toMap(): Map<K, V>

Returns a new map containing all key-value pairs from the given collection of pairs.

The returned map preserves the entry iteration order of the original collection. If any of two pairs would have the same key the last one gets added to the map.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V, M : MutableMap<in K, in V>> Iterable<Pair<K, V>>.toMap(
    destination: M
): M

Populates and returns the destination mutable map with key-value pairs from the given collection of pairs.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V> Array<out Pair<K, V>>.toMap(): Map<K, V>

Returns a new map containing all key-value pairs from the given array of pairs.

The returned map preserves the entry iteration order of the original array. If any of two pairs would have the same key the last one gets added to the map.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V, M : MutableMap<in K, in V>> Array<out Pair<K, V>>.toMap(
    destination: M
): M

Populates and returns the destination mutable map with key-value pairs from the given array of pairs.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V> Sequence<Pair<K, V>>.toMap(): Map<K, V>

Returns a new map containing all key-value pairs from the given sequence of pairs.

The returned map preserves the entry iteration order of the original sequence. If any of two pairs would have the same key the last one gets added to the map.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V, M : MutableMap<in K, in V>> Sequence<Pair<K, V>>.toMap(
    destination: M
): M

Populates and returns the destination mutable map with key-value pairs from the given sequence of pairs.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <K, V> Map<out K, V>.toMap(): Map<K, V>

Returns a new read-only map containing all key-value pairs from the original map.

The returned map preserves the entry iteration order of the original map.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.toMap(
    destination: M
): M

Populates and returns the destination mutable map with key-value pairs from the given map.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/to-map.html