iterator-utils
Provides classes and interfaces to help implement iterators. Below are some examples; for a full list, see the API.
LookaheadIterator
Class LookaheadIterator is a base class that lets you easily implement iterators that need to calculate the next value in order to let hasNext() return whether or not there is a next value.
StreamLikeIterator
Interface StreamLikeIterator extends Iterator to add several Stream operations. Unlike streams, instances of StreamLikeIterator support removal if a) the original iterator does, and b) no intermediate step removes support for removal (e.g., flatMap).
IteratorUtils
Class IteratorUtils provides several utility methods. These include:
singletonIteratorto create an (unmodifiable) iterator containing only a single element.unmodifiableIteratorto create an unmodifiable wrapper around an iterator.- methods to wrap an existing iterator to add functionality of
Stream. This allows single operations to be used without having to useStreamLikeIterator. - methods to create a
Streamfor an iterator. - methods to create a single iterator backed by several other iterators or iterables.
