org.hammerlab.iterator
Given an Iterator of Ints, collapse contiguous "ranges" of integers that are each 1 greater than their predecessor.
For example, given an input [2, 3, 1, 4, 5, 6, 5, 6, 8], this would emit Ranges (in half-open notation): [2, 4), [1, 2), [4, 7), [5, 7), [8, 9).
See RangeAccruingIteratorTest for more examples.
(Changed in version 2.8.0) collect has changed. The previous behavior can be reproduced with toSeq.
collect
toSeq
(Since version 2.10.0) use fold instead
Given an Iterator of Ints, collapse contiguous "ranges" of integers that are each 1 greater than their predecessor.
For example, given an input [2, 3, 1, 4, 5, 6, 5, 6, 8], this would emit Ranges (in half-open notation): [2, 4), [1, 2), [4, 7), [5, 7), [8, 9).
See RangeAccruingIteratorTest for more examples.