Interface Iterators.LookaheadIterator<A>

Type Parameters:
A - the element type
All Superinterfaces:
Iterator<A>
All Known Subinterfaces:
Iterators.PushbackIterator<A>
Enclosing class:
Iterators

public static interface Iterators.LookaheadIterator<A> extends Iterator<A>
Iterators that can look one element ahead.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the next element without changing the state of the iterator.

    Methods inherited from interface java.util.Iterator

    forEachRemaining, hasNext, next, remove
  • Method Details

    • lookahead

      A lookahead()
      Returns the next element without changing the state of the iterator.

      This method my be called precisely when next may also be called. The returned value is the same. The observable state of the iterator is not changed: Subsequent calls to lookahead, and one subsequent call to next will return the same element.

      Returns:
      the next element
      Throws:
      NoSuchElementException - if there are no more elements