Class FilteredIterator<E>

  • Type Parameters:
    E - the type of elements returned by this iterator
    All Implemented Interfaces:
    Iterator<E>

    public class FilteredIterator<E>
    extends com.google.common.collect.AbstractIterator<E>
    A wrapper for a TreeIterator that only returns nodes that satisfy a predicate and skips all others and their descendants.
    • Constructor Detail

      • FilteredIterator

        public FilteredIterator​(TreeIterator<E> delegate,
                                com.google.common.base.Predicate<? super E> predicate)
        Constructs a new iterator.
        Parameters:
        delegate - a tree iterator
        predicate - the predicate to satisfy; all nodes (including their descendants) for which the predicate yields false are skipped
    • Method Detail

      • computeNext

        protected E computeNext()
        Specified by:
        computeNext in class com.google.common.collect.AbstractIterator<E>