Class CriterionIterator<T>
- java.lang.Object
-
- com.saperion.common.lang.iterator.CriterionIterator<T>
-
- Type Parameters:
T
- type of objects to iterate
- All Implemented Interfaces:
java.util.Iterator<T>
public final class CriterionIterator<T> extends java.lang.Object implements java.util.Iterator<T>
An
Iterator
that filters the objects of an existing iterator using aCriterion
.Iterator.remove()
is not supported.- Author:
- agz
-
-
Constructor Summary
Constructors Constructor Description CriterionIterator(java.util.Iterator<? extends T> iterator, Criterion<? super T> criterion)
Creates a newCriterionIterator
, that filters the objects of the specified iterator using the specifiedCriterion
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
T
next()
void
remove()
java.lang.String
toString()
-
-
-
Constructor Detail
-
CriterionIterator
public CriterionIterator(java.util.Iterator<? extends T> iterator, Criterion<? super T> criterion)
Creates a newCriterionIterator
, that filters the objects of the specified iterator using the specifiedCriterion
. The specified iterator must not benull
. The specified criterion may benull
, in which case no filtering is done and the returned iterator iterates through all objects of the specified iterator.- Parameters:
iterator
- underlying iterator whose iteration should be filteredcriterion
- filter-Criterion
-
-