Class FilteringIterator<T>

  • Type Parameters:
    T - the type being iterated
    All Implemented Interfaces:
    Iterator<T>

    public class FilteringIterator<T>
    extends Object
    implements Iterator<T>
    A FilteringIterator that filters elements in another Iterator based on a specified Remote.Predicate.
    Since:
    21.12
    Author:
    bo
    • Field Detail

      • f_iterator

        protected final Iterator<T> f_iterator
        The underlying Iterator of elements to be filtered.
      • f_predicate

        protected final com.tangosol.util.function.Remote.Predicate<? super T> f_predicate
        The Remote.Predicate that must be satisfied for an element to be returned by the Iterator.
      • m_element

        protected T m_element
        The next element to return from the Iterator that matched the Remote.Predicate.
    • Constructor Detail

      • FilteringIterator

        public FilteringIterator​(Iterator<T> iterator,
                                 com.tangosol.util.function.Remote.Predicate<? super T> predicate)
        Constructs a FilteringIterator.
        Parameters:
        iterator - the Iterator of elements to filter
        predicate - the Remote.Predicate that must be satisfied
    • Method Detail

      • hasNext

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

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

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