groupBy method
- T selector(
- E el
Implementation
List<List<E>> groupBy(T Function(E el) selector) {
Map<T, List<E>> map = {};
for (E el in this) {
if (map[selector(el)] == null) {
map[selector(el)] = [el];
continue;
}
map[selector(el)]!.add(el);
}
return map.entries.map((el) => el.value).toList();
}