groupBy<K> method

Map<K, List<T>> groupBy<K>(
  1. K fn(
    1. T
    )
)

Implementation

Map<K, List<T>> groupBy<K>(K Function(T) fn) => fold(
    <K, List<T>>{},
    (Map<K, List<T>> map, T element) =>
        map..putIfAbsent(fn(element), () => <T>[]).add(element));