net.sourceforge.nite.util
Class IteratorTransformFilter
java.lang.Object
net.sourceforge.nite.util.IteratorTransformFilter
- All Implemented Interfaces:
- java.util.Iterator
public class IteratorTransformFilter
- extends java.lang.Object
- implements java.util.Iterator
An IteratorTransform is used to transform Objects in an Iterator
and present them as a new Iterator.
The difference with a normal IteratorTransform is that this implementation will
not throw exceptions when the transformation fails but rather will act as a filter
for those objects, passing on only those objects in the original iterator on
which the transformation can be successfully applied.
I.e., the function hasNext will return true if the original iterator has no
next object that can be transformed.
NB: This is a VERY expensive iterator when there are many objects that cannot
be transformed, due to all the exceptions that will be thrown.
- Author:
- Dennis Reidsma, UTwente
Adapted from the parlevink package (HMI group, University of Twente)
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IteratorTransformFilter
public IteratorTransformFilter(java.util.Iterator it,
Transform trans)
- Parameters:
it
- The Iterator to filtertrans
- The Transformation
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator
- Throws:
java.lang.UnsupportedOperationException
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