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

groupByTo

inline fun <T, K, M : MutableMap<in K, MutableList<T>>> MongoIterable<T>.groupByTo(destination: M, crossinline keySelector: (T) -> K): M (source)

Groups elements of the original collection by the key returned by the given keySelector function applied to each element and puts to the destination map each group key associated with a list of corresponding elements.

//Unresolved: samples.collections.Collections.Transformations.groupBy

Return
The destination map.

inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> MongoIterable<T>.groupByTo(destination: M, crossinline keySelector: (T) -> K, crossinline valueTransform: (T) -> V): M (source)

Groups values returned by the valueTransform function applied to each element of the original collection by the key returned by the given keySelector function applied to the element and puts to the destination map each group key associated with a list of corresponding values.

//Unresolved: samples.collections.Collections.Transformations.groupByKeysAndValues

Return
The destination map.