Class LookAheadIterator<E>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.util.Iterator<E>
    Direct Known Subclasses:
    UnionIterator

    public abstract class LookAheadIterator<E>
    extends AbstractCloseableIterator<E>
    • Field Detail

      • nextElement

        private E nextElement
      • closeException

        private java.io.IOException closeException
    • Constructor Detail

      • LookAheadIterator

        protected LookAheadIterator()
    • Method Detail

      • getNextElement

        protected abstract E getNextElement()
        Gets the next element. Subclasses should implement this method so that it returns the next element.
        Returns:
        The next element, or null if no more elements are available.
      • hasNext

        public final boolean hasNext()
      • next

        public final E next()
      • lookAhead

        private void lookAhead()
        Fetches the next element if it hasn't been fetched yet and stores it in nextElement.
        Throws:
        X
      • remove

        public void remove()
        Throws an UnsupportedOperationException.