assoc

fun <K, V> Iterable<Pair<K, V>>.assoc(): Map<K, V>
fun <K, V> Sequence<Pair<K, V>>.assoc(): Map<K, V>

Returns a Map containing 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.

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

inline fun <T, K, V> Iterable<T>.assoc(transform: (T) -> Pair<K, V>): Map<K, V>
inline fun <T, K, V> Sequence<T>.assoc(transform: (T) -> Pair<K, V>): Map<K, V>

Returns a Map containing key-value pairs provided by transform function applied to 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.

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