Class Filterator<E>

  • Type Parameters:
    E - Element type
    All Implemented Interfaces:

    public class Filterator<E>
    extends java.lang.Object
    implements java.util.Iterator<E>
    Filtered iterator class: an iterator that includes only elements that are instanceof a specified class.

    Apologies for the dorky name.

    See Also:
    Util.cast(java.util.List, Class), Util.cast(Iterator, Class)
    • Field Summary

      Modifier and Type Field Description
      (package private) java.lang.Class<E> includeFilter  
      (package private) java.util.Iterator<? extends java.lang.Object> iterator  
      (package private) E lookAhead  
      (package private) boolean ready  
    • Constructor Summary

      Constructor Description
      Filterator​(java.util.Iterator<?> iterator, java.lang.Class<E> includeFilter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      E next()  
      void remove()  
      • 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

    • Field Detail

      • includeFilter

        java.lang.Class<E> includeFilter
      • iterator

        java.util.Iterator<? extends java.lang.Object> iterator
      • lookAhead

        E lookAhead
      • ready

        boolean ready
    • Constructor Detail

      • Filterator

        public Filterator​(java.util.Iterator<?> iterator,
                          java.lang.Class<E> includeFilter)
    • Method Detail

      • hasNext

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

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

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<E>