common
Class FilteredIterator
java.lang.Object
common.FilteredIterator
- All Implemented Interfaces:
- java.util.Iterator
- Direct Known Subclasses:
- FilteredMapIterator
public abstract class FilteredIterator
- extends java.lang.Object
- implements java.util.Iterator
Abstract class for Iterator objects that filter or transform the objects
returned by an underlying iterator. Subclasses must implement the
filter
method, which takes an object returned by the
underlying iterator, and either:
- returns null, in which case the FilteredIterator skips this object;
- returns a non-null object, which will be returned by the
FilteredIterator.
Constructor Summary |
FilteredIterator(java.util.Iterator underlying)
Creates a new FilteredIterator on the given underlying iterator. |
Method Summary |
protected abstract java.lang.Object |
filter(int index,
java.lang.Object obj)
|
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 |
FilteredIterator
public FilteredIterator(java.util.Iterator underlying)
- Creates a new FilteredIterator on the given underlying iterator.
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator
next
public java.lang.Object next()
- Specified by:
next
in interface java.util.Iterator
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator
filter
protected abstract java.lang.Object filter(int index,
java.lang.Object obj)