kmongo / kotlin.collections / com.mongodb.client.MongoIterable / associate

associate

inline fun <T, K, V> MongoIterable<T>.associate(crossinline transform: (T) -> Pair<K, V>): Map<K, V> (source)

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.

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