assocWithTo

inline fun <K, V, M : MutableMap<in K, in V>> Iterable<K>.assocWithTo(destination: M, valueSelector: (K) -> V): M(source)
inline fun <K, V, M : MutableMap<in K, in V>> Sequence<K>.assocWithTo(destination: M, valueSelector: (K) -> V): M(source)

Populates and returns the destination mutable map with key-value pairs for each element of the given collection, where key is the element itself and value is provided by the valueSelector function applied to that key.

If any two elements are equal, the last one overwrites the former value in the map and the method creates a warning.