groupByTo
inline fun <T, K, M : MutableMap<in K, MutableList<T>>> MongoIterable<T>.groupByTo(destination: M, crossinline keySelector: (T) -> K): M
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.
Return
The destination map.
Samples
samples.collections.Collections.Transformations.groupByinline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> MongoIterable<T>.groupByTo(destination: M, crossinline keySelector: (T) -> K, crossinline valueTransform: (T) -> V): M
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.
Return
The destination map.