Class FilteringIterator<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    Iterator<T>

    public class FilteringIterator<T>
    extends Object
    implements Iterator<T>
    Implements a Filtering Iterator that will return only items that match the Predicate.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Returns true if the wrapped iterator contains an element that matches the Predicate
        Specified by:
        hasNext in interface Iterator<T>
        Returns:
        True if there is a matching element, false otherwise
      • next

        public T next()
        Returns the next object from the feed
        Specified by:
        next in interface Iterator<T>
        Returns:
        the next object
      • remove

        public void remove()
        Throws an UnsupportedOperationException because this iterator looks ahead and cannot retroactively support deletion of records
        Specified by:
        remove in interface Iterator<T>