net.sf.jga.util
Class TransformIterator<T,R>
java.lang.Object
net.sf.jga.util.TransformIterator<T,R>
- All Implemented Interfaces:
- java.lang.Iterable<R>, java.util.Iterator<R>
public class TransformIterator<T,R>
- extends java.lang.Object
- implements java.util.Iterator<R>, java.lang.Iterable<R>
Iterator that returns the results of applying the given functor to the
elements of the given iterator.
Copyright © 2002 David A. Hall
- Author:
- David A. Hall
|
Constructor Summary |
TransformIterator(java.util.Iterator<? extends T> iter,
UnaryFunctor<T,R> fn)
Builds a TransformIterator that applies the given functor to each element
of the given base iterator. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransformIterator
public TransformIterator(java.util.Iterator<? extends T> iter,
UnaryFunctor<T,R> fn)
- Builds a TransformIterator that applies the given functor to each element
of the given base iterator.
iterator
public java.util.Iterator<R> iterator()
- Specified by:
iterator in interface java.lang.Iterable<R>
hasNext
public boolean hasNext()
- Specified by:
hasNext in interface java.util.Iterator<R>
next
public R next()
- Specified by:
next in interface java.util.Iterator<R>
remove
public void remove()
- Specified by:
remove in interface java.util.Iterator<R>
Copyright © 2002-2005 David A. Hall. All Rights Reserved.