https://kotlinlang.org logo
#announcements
Title
# announcements
a

andrewoma

01/17/2016, 11:23 PM
Not sure I follow. The
groupBy
accepts a key selector function:
Copy code
/**
 * 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)
}