peekingIterator

Decorates the specified iterator to support one-element lookahead.

If the iterator is already a PeekingIterator it is returned directly.

Return

a new peeking iterator

Parameters

<E>

the element type

iterator

the iterator to decorate

Throws

if the iterator is null