|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections15.iterators.FilterIterator<E>
public class FilterIterator<E>
Decorates an iterator such that only elements matching a predicate filter are returned.
| Constructor Summary | |
|---|---|
FilterIterator()
Constructs a new FilterIterator that will not function
until setIterator is invoked. |
|
FilterIterator(Iterator<E> iterator)
Constructs a new FilterIterator that will not function
until setPredicate is invoked. |
|
FilterIterator(Iterator<E> iterator,
Predicate<? super E> predicate)
Constructs a new FilterIterator that will use the
given iterator and predicate. |
|
| Method Summary | |
|---|---|
Iterator<E> |
getIterator()
Gets the iterator this iterator is using. |
Predicate<? super E> |
getPredicate()
Gets the predicate this iterator is using. |
boolean |
hasNext()
Returns true if the underlying iterator contains an object that matches the predicate. |
E |
next()
Returns the next object that matches the predicate. |
void |
remove()
Removes from the underlying collection of the base iterator the last element returned by this iterator. |
void |
setIterator(Iterator<E> iterator)
Sets the iterator for this iterator to use. |
void |
setPredicate(Predicate<? super E> predicate)
Sets the predicate this the iterator to use. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FilterIterator()
FilterIterator that will not function
until setIterator is invoked.
public FilterIterator(Iterator<E> iterator)
FilterIterator that will not function
until setPredicate is invoked.
iterator - the iterator to use
public FilterIterator(Iterator<E> iterator,
Predicate<? super E> predicate)
FilterIterator that will use the
given iterator and predicate.
iterator - the iterator to usepredicate - the predicate to use| Method Detail |
|---|
public boolean hasNext()
hasNext in interface Iterator<E>public E next()
next in interface Iterator<E>NoSuchElementException - if there are no more elements that
match the predicatepublic void remove()
next() was called, but not after
hasNext(), because the hasNext() call
changes the base iterator.
remove in interface Iterator<E>IllegalStateException - if hasNext() has already
been called.public Iterator<E> getIterator()
public void setIterator(Iterator<E> iterator)
iterator - the iterator to usepublic Predicate<? super E> getPredicate()
public void setPredicate(Predicate<? super E> predicate)
predicate - the transformer to use
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||