Package org.plumelib.util
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 Filter.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) TThe next object that this iterator will yield, orinvalidTifcurrentValidis false.(package private) booleanTrue iffcurrentis an object from the wrapped iterator.The predicate that determines which elements to retain.(package private) TA marker object, distinct from any object that the iterator can return.The iterator that this object is filtering. -
Constructor Summary
ConstructorsConstructorDescriptionFilteredIterator(Iterator<T> itor, Filter<T> filter) Create an iterator that only returns elements ofitorthat match the given Filter. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
itor
The iterator that this object is filtering. -
filter
The predicate that determines which elements to retain. -
invalidT
A marker object, distinct from any object that the iterator can return. -
current
The next object that this iterator will yield, orinvalidTifcurrentValidis false. -
currentValid
boolean currentValidTrue iffcurrentis an object from the wrapped iterator.
-
-
Constructor Details
-
FilteredIterator
Create an iterator that only returns elements ofitorthat match the given Filter.- Parameters:
itor- the Iterator to filterfilter- the predicate that determines which elements to retain
-
-
Method Details