Class StoppableIterator<T>

java.lang.Object
ch.njol.util.coll.iterator.StoppableIterator<T>
All Implemented Interfaces:
Iterator<T>
Direct Known Subclasses:
BlockLineIterator

public class StoppableIterator<T> extends Object implements Iterator<T>
  • Constructor Details

    • StoppableIterator

      public StoppableIterator(Iterator<T> iter, NullableChecker<T> stopper, boolean returnLast)
      Parameters:
      iter -
      stopper - Called for every element. If it returns true the iteration is stopped.
      returnLast - Whether to return the last element, i.e. the element on which the stopper stops. This doesn't change anything if the iterator ends before the stopper stops.
  • Method Details

    • hasNext

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

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

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

      public void stop()