Class CloseableIterator<T>

java.lang.Object
org.apache.maven.surefire.api.util.CloseableIterator<T>
Type Parameters:
T - the type of elements returned by this iterator
All Implemented Interfaces:
Iterator<T>

public abstract class CloseableIterator<T> extends Object implements Iterator<T>
This iterator is marked as stopped if isClosed() returns true. If the iterator has been closed before calling hasNext() then the method returns false. If the iterator was closed after hasNext returns true but before next(), the method next() throws NoSuchElementException. The method remove() throws IllegalStateException if the iterator has been closed.
Since:
2.19.1
Author:
Tibor Digana (tibor17)
  • Constructor Details

    • CloseableIterator

      public CloseableIterator()
  • Method Details

    • isClosed

      protected abstract boolean isClosed()
    • doHasNext

      protected abstract boolean doHasNext()
    • doNext

      protected abstract T doNext()
    • doRemove

      protected abstract void doRemove()
    • hasNext

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

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

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