polyglot.util
Class FilteringIterator
java.lang.Object
polyglot.util.FilteringIterator
- All Implemented Interfaces:
- java.util.Iterator
public final class FilteringIterator
- extends java.lang.Object
- implements java.util.Iterator
FilteringIterator
Overview:
This iterator wraps another iterator, and returns only those elements
for which a given predicate is true.
Does not support Remove.
Constructor Summary |
FilteringIterator(java.util.Collection coll,
Predicate pred)
Constructs a new FilteringIterator which returns only those elements of
which have true. |
FilteringIterator(java.util.Iterator iter,
Predicate pred)
Constructs a new FilteringIterator which returns all the elements
of , in order, only when they have true. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilteringIterator
public FilteringIterator(java.util.Collection coll,
Predicate pred)
- Constructs a new FilteringIterator which returns only those elements of
which have true.
FilteringIterator
public FilteringIterator(java.util.Iterator iter,
Predicate pred)
- Constructs a new FilteringIterator which returns all the elements
of , in order, only when they have true.
next
public java.lang.Object next()
- Specified by:
next
in interface java.util.Iterator
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator