groupBy method

Set<Set<E>> groupBy(
  1. bool groupFunction(
    1. dynamic a,
    2. dynamic b
    )
)

Items are grouped together if they meet the criteria that compares consecutive elements.

1, 2, 3, 2, 1.groupBy((a, b) => a < b) returns [1, 2, 3, 2, 1]. In this example, items are grouped together if they are less than the next one i.e. a < b.

Implementation

Set<Set<E>> groupBy(bool Function(dynamic a, dynamic b) groupFunction) {
  return h
      .groupByIterable(
        groupFunction: groupFunction,
        original: this,
      )
      .toNestedSet();
}