java.lang.Object | |
↳ | org.apache.commons.collections.iterators.FilterIterator |
Known Direct Subclasses |
Decorates another Iterator using a predicate to filter elements.
This iterator decorates the underlying iterator, only allowing through
those elements that match the specified Predicate
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
FilterIterator that will not function
until setIterator is invoked. | |||||||||||
Constructs a new
FilterIterator that will not function
until setPredicate is invoked. | |||||||||||
Constructs a new
FilterIterator that will use the
given iterator and predicate. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the iterator this iterator is using.
| |||||||||||
Gets the predicate this iterator is using.
| |||||||||||
Returns true if the underlying iterator contains an object that
matches the predicate.
| |||||||||||
Returns the next object that matches the predicate.
| |||||||||||
Removes from the underlying collection of the base iterator the last
element returned by this iterator.
| |||||||||||
Sets the iterator for this iterator to use.
| |||||||||||
Sets the predicate this the iterator to use.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.util.Iterator
|
Constructs a new FilterIterator
that will not function
until setIterator
is invoked.
Constructs a new FilterIterator
that will not function
until setPredicate
is invoked.
iterator | the iterator to use |
---|
Constructs a new FilterIterator
that will use the
given iterator and predicate.
iterator | the iterator to use |
---|---|
predicate | the predicate to use |
Returns true if the underlying iterator contains an object that matches the predicate.
NullPointerException | if either the iterator or predicate are null |
---|
Returns the next object that matches the predicate.
NullPointerException | if either the iterator or predicate are null |
---|---|
NoSuchElementException | if there are no more elements that match the predicate |
Removes from the underlying collection of the base iterator the last
element returned by this iterator.
This method can only be called
if next()
was called, but not after
hasNext()
, because the hasNext()
call
changes the base iterator.
IllegalStateException | if hasNext() has already
been called.
|
---|
Sets the iterator for this iterator to use. If iteration has started, this effectively resets the iterator.
iterator | the iterator to use |
---|
Sets the predicate this the iterator to use.
predicate | the predicate to use |
---|