common-util

local.tomas.util.collections
Class MappedIterator<F,T>

java.lang.Object
  extended by local.tomas.util.collections.MappedIterator<F,T>
Type Parameters:
F - original element type
T - mapped element type
All Implemented Interfaces:
Iterator<T>
Direct Known Subclasses:
MappedListIterator

public class MappedIterator<F,T>
extends Object
implements Iterator<T>

Mapped iterator. A mapped iterator iterates over the elements of the base iterator mapped through a mapping.

Author:
tomas.teubner

Field Summary
protected  ObjectMapping<T> mapper
           
 
Constructor Summary
MappedIterator(Iterator<F> iterator, ObjectMapping<T> mapper)
          Construct mapped iterator.
 
Method Summary
 boolean hasNext()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapper

protected final ObjectMapping<T> mapper
Constructor Detail

MappedIterator

public MappedIterator(Iterator<F> iterator,
                      ObjectMapping<T> mapper)
Construct mapped iterator.

Parameters:
iterator - base iterator
mapper - mapping
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>

common-util

Copyright © 2005-2007 Tomas Teubner. All Rights Reserved.