Class FilterIterator<T,​InnerT extends T>

  • Type Parameters:
    T - generic parameter for this iterator instance: this iterator implements Iterator<T>
    InnerT - generic parameter of the wrapped iterator, must be T or extend T
    All Implemented Interfaces:
    Iterator<T>

    public abstract class FilterIterator<T,​InnerT extends T>
    extends Object
    implements Iterator<T>
    An Iterator implementation that filters elements with a boolean predicate.
    See Also:
    predicateFunction(InnerT)
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Constructor Detail

      • FilterIterator

        public FilterIterator​(Iterator<InnerT> baseIterator)
    • Method Detail

      • predicateFunction

        protected abstract boolean predicateFunction​(InnerT object)
        returns true, if this element should be returned by next().
      • hasNext

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

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

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