Class CollectionsPlume.FilteredIterator<T extends @Nullable Object>

java.lang.Object
org.plumelib.util.CollectionsPlume.FilteredIterator<T>
Type Parameters:
T - the type of elements of the iterator
All Implemented Interfaces:
Iterator<T>
Enclosing class:
CollectionsPlume

public static final class CollectionsPlume.FilteredIterator<T extends @Nullable Object> extends Object implements Iterator<T>
An iterator that only returns elements that match the given predicate.
  • Constructor Details

    • FilteredIterator

      public FilteredIterator(Iterator<T> itor, Predicate<T> predicate)
      Create an iterator that only returns elements of itor that match the given predicate.
      Parameters:
      itor - the Iterator to filter
      predicate - the predicate that determines which elements to retain
  • Method Details

    • hasNext

      public boolean hasNext(@GuardSatisfied CollectionsPlume.FilteredIterator<T extends @Nullable Object> this)
      Specified by:
      hasNext in interface Iterator<T extends @Nullable Object>
    • next

      public T next(@GuardSatisfied CollectionsPlume.FilteredIterator<T extends @Nullable Object> this)
      Specified by:
      next in interface Iterator<T extends @Nullable Object>
    • remove

      public void remove(@GuardSatisfied CollectionsPlume.FilteredIterator<T extends @Nullable Object> this)
      Specified by:
      remove in interface Iterator<T extends @Nullable Object>