Class FilterIterator<T>

  • Type Parameters:
    T - the type of objects produced by this Iterator
    All Implemented Interfaces:, java.lang.AutoCloseable, java.util.Iterator<T>, CloseableIterator<T>

    public abstract class FilterIterator<T>
    extends java.lang.Object
    implements CloseableIterator<T>
    An Iterator that filters another Iterator.
    • Constructor Summary

      Modifier Constructor Description
      protected FilterIterator​(java.util.Iterator<T> items)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean hasNext()  
      T next()  
      protected abstract boolean shouldKeep​(T item)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Constructor Detail

      • FilterIterator

        protected FilterIterator​(java.util.Iterator<T> items)
    • Method Detail

      • shouldKeep

        protected abstract boolean shouldKeep​(T item)
      • hasNext

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

        public T next()
        Specified by:
        next in interface java.util.Iterator<T>
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface