polyglot.util
Class FilteringIterator

java.lang.Object
  extended by 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.
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.

Method Detail

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