PeekingIterator
Decorates an iterator to support one-element lookahead while iterating.
The decorator supports the removal operation, but an IllegalStateException will be thrown if remove, add, set} is called directly after a call to peek or element.
Since
4.0
Parameters
<E>
the type of elements returned by this iterator.