|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.apache.commons.collections.iterators.ProxyIterator
|
+--org.apache.commons.collections.iterators.FilterIterator
A Proxy Iterator which takes a Predicate instance to filter
out objects from an underlying Iterator instance.
Only objects for which the
specified Predicate evaluates to true are
returned.
| Constructor Summary | |
FilterIterator()
Constructs a new FilterIterator that will not function
until setIterator is invoked. |
|
FilterIterator(java.util.Iterator iterator)
Constructs a new FilterIterator that will not function
until setPredicate is invoked. |
|
FilterIterator(java.util.Iterator iterator,
Predicate predicate)
Constructs a new FilterIterator that will use the
given iterator and predicate. |
|
| Method Summary | |
Predicate |
getPredicate()
Getter for property predicate. |
boolean |
hasNext()
Returns true if the underlying iterator contains an object that matches the predicate. |
java.lang.Object |
next()
Returns the next object that matches the predicate. |
void |
remove()
Always throws UnsupportedOperationException as this class does look-ahead with its internal iterator. |
void |
setPredicate(Predicate predicate)
Setter for property predicate. |
| Methods inherited from class org.apache.commons.collections.iterators.ProxyIterator |
getIterator, setIterator |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FilterIterator()
FilterIterator that will not function
until setIterator is invoked.
public FilterIterator(java.util.Iterator iterator)
FilterIterator that will not function
until setPredicate is invoked.
iterator - the iterator to use
public FilterIterator(java.util.Iterator iterator,
Predicate 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 java.util.IteratorhasNext in class ProxyIteratorpublic java.lang.Object next()
next in interface java.util.Iteratornext in class ProxyIteratorjava.util.NoSuchElementException - if there are no more elements that
match the predicatepublic void remove()
remove in interface java.util.Iteratorremove in class ProxyIteratorjava.lang.UnsupportedOperationException - alwayspublic Predicate getPredicate()
public void setPredicate(Predicate predicate)
predicate - New value of property predicate.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||