Given an iterator and a predicate function, emit iterators containing maximal runs of sequential elements that all satisfy the predicate, or individual elements that do not.
Wrap a BufferedReader and emit lines.
Given an Iterator of Ints, collapse contiguous "ranges" of integers that are each 1 greater than their predecessor.
Run-length encode an input iterator, replacing contiguous runs of identical elements with pairs consisting of the first element in the run and the number of elements observed.
Interface for implementing BufferedIterators following a common pattern: the hasNext
implementation must
actually compute the next element (or return a sentinel that implies that one doesn't exist), and should therefore
cache that element to serve head
and next()
calls.
Given an Iterator[T], emit each element sandwiched between its preceding and succeeding elements.
For each element in an input Iterator, emit the sequence of elements from the current one to the next sentinel
value (or the end of the iterator, if no more sentinels follow the current element).