Class AbstractIterator<T>

    • Constructor Detail

      • AbstractIterator

        protected AbstractIterator()
    • Method Detail

      • computeNext

        protected abstract T computeNext()
        Computes the next element in the iteration. Subclasses must implement this method and call endOfData() when no more elements are available.
        Returns:
        the next element, or endOfData() if iteration is over
      • endOfData

        protected final T endOfData()
        Signals that the iteration has no more elements. Should be called from computeNext() to end iteration.
        Returns:
        null, indicating end of data
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<T>
      • next

        public T next()
        Specified by:
        next in interface Iterator<T>