org.apache.commons.collections.iterators
Class FilterIterator
- Iterator
public class 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.
Predicate | getPredicate() - Getter for property predicate.
|
boolean | hasNext() - Returns true if the underlying iterator contains an object that
matches the predicate.
|
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.
|
FilterIterator
public FilterIterator()
Constructs a new
FilterIterator
that will not function
until
setIterator
is invoked.
FilterIterator
public FilterIterator(Iterator iterator)
Constructs a new
FilterIterator
that will not function
until
setPredicate
is invoked.
iterator
- the iterator to use
FilterIterator
public FilterIterator(Iterator iterator,
Predicate predicate)
Constructs a new FilterIterator
that will use the
given iterator and predicate.
iterator
- the iterator to usepredicate
- the predicate to use
getPredicate
public Predicate getPredicate()
Getter for property predicate.
- Value of property predicate.
hasNext
public boolean hasNext()
Returns true if the underlying iterator contains an object that
matches the predicate.
- hasNext in interface ProxyIterator
- true if there is another object that matches the predicate
next
public Object next()
Returns the next object that matches the predicate.
- next in interface ProxyIterator
- the next object which matches the given predicate
remove
public void remove()
Always throws UnsupportedOperationException as this class
does look-ahead with its internal iterator.
- remove in interface ProxyIterator
setPredicate
public void setPredicate(Predicate predicate)
Setter for property predicate.
predicate
- New value of property predicate.
Copyright © 2001-2004 Apache Software Foundation. Documenation generated ${TODAY}.