compact method

Iterable<Range<E>> compact({
  1. required E nextValue(
    1. E current
    ),
  2. required Comparator<E> compare,
})

Compacts this Iterable into a list of Ranges based on nextValue and compare.

Example:

const [1, 2, 3, 4, 5, 8].compact(
  nextValue: (current) => current + 1,
  compare: Comparable.compare,
).toList() == const [(from: 1, to: 6), (from: 8, to: 9)]

See also:

Implementation

Iterable<Range<E>> compact({
  required E Function(E current) nextValue,
  required Comparator<E> compare,
}) =>
    _compact(nextValue: nextValue, compare: compare);