Interface Iterators.PushbackIterator<A>

Type Parameters:
A - the element type
All Superinterfaces:
Iterator<A>, Iterators.LookaheadIterator<A>
Enclosing class:
Iterators

public static interface Iterators.PushbackIterator<A> extends Iterators.LookaheadIterator<A>
Iterators that can push an element back into the sequence.
  • Method Details

    • pushback

      void pushback(A elem)
      Push an element back into the sequence.

      This method may be called either when the iterator is in its initial state, or after next and/or remove have been called. It may not be called after lookahead, or twice in a row.

      Conversely, pushed back elements may not be removed.

      Parameters:
      elem - the element to push back
      Throws:
      IllegalStateException - if the method may not be called just now