assocTo

fun <K, V, M : MutableMap<in K, in V>> Iterable<Pair<K, V>>.assocTo(destination: M): M(source)
fun <K, V, M : MutableMap<in K, in V>> Sequence<Pair<K, V>>.assocTo(destination: M): M(source)

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

If any of two pairs would have the same key the last one gets added to the map and the method creates a warning.


inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.assocTo(destination: M, transform: (T) -> Pair<K, V>): M(source)
inline fun <T, K, V, M : MutableMap<in K, in V>> Sequence<T>.assocTo(destination: M, transform: (T) -> Pair<K, V>): M(source)

Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given collection.

If any of two pairs would have the same key the last one gets added to the map and the method creates a warning.