Class PeekableIterator<Object>

    • Constructor Detail

      • PeekableIterator

        public PeekableIterator​(Iterator<Object> iterator)
        Constructs a new iterator that wraps the supplied iterator.
    • Method Detail

      • hasNext

        public boolean hasNext()
        True if there are more items, in which case both next() and peek() will return a value.
        Specified by:
        hasNext in interface Iterator<Object>
      • next

        public Object next()
        Returns the next object and advances the iterator.
        Specified by:
        next in interface Iterator<Object>
      • peek

        public Object peek()
        Returns the next object but does not advance the iterator. Subsequent calls to peek() and next() will return the same object.
      • remove

        public void remove()
        Unsupported Operation.
        Specified by:
        remove in interface Iterator<Object>