andrewoma
01/17/2016, 11:23 PMgroupBy
accepts a key selector function:
/**
* Returns a map of the elements in original collection grouped by the key returned by the given [selector] function.
*/
public inline fun <T, K> Iterable<T>.groupBy(selector: (T) -> K): Map<K, List<T>> {
return groupByTo(LinkedHashMap<K, MutableList<T>>(), selector)
}