Package generic.util

Interface PeekableIterator<T>

  • Type Parameters:
    T - The type of this iterator.
    All Superinterfaces:
    java.util.Iterator<T>
    All Known Implementing Classes:
    WrappingPeekableIterator

    public interface PeekableIterator<T>
    extends java.util.Iterator<T>
    An iterator that allows you to peek at the next item on the iterator.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T peek()
      Returns the item that would be returned by calling Iterator.next(), but does not increment the iterator as next would.
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, hasNext, next, remove
    • Method Detail

      • peek

        T peek()
        throws java.util.NoSuchElementException
        Returns the item that would be returned by calling Iterator.next(), but does not increment the iterator as next would.
        Returns:
        the item that would be returned by calling Iterator.next()
        Throws:
        java.util.NoSuchElementException