compact method
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:
- RangeExtension.explode for the inverse operation.
Implementation
Iterable<Range<E>> compact({
required E Function(E current) nextValue,
required Comparator<E> compare,
}) =>
_compact(nextValue: nextValue, compare: compare);