net.sf.javagimmicks.collections.transformer.TransformingIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gimmicks Show documentation
Show all versions of gimmicks Show documentation
Utility classes, APIs and tools for Java
package net.sf.javagimmicks.collections.transformer;
import java.util.Iterator;
import net.sf.javagimmicks.transform.Transformer;
import net.sf.javagimmicks.transform.Transforming;
class TransformingIterator implements Iterator, Transforming
{
protected final Iterator _internalIterator;
private final Transformer _transformer;
/**
* @deprecated Use TranformerUtils.decorate() instead
*/
@Deprecated
public TransformingIterator(Iterator iterator, Transformer transformer)
{
_internalIterator = iterator;
_transformer = transformer;
}
public Transformer getTransformer()
{
return _transformer;
}
public boolean hasNext()
{
return _internalIterator.hasNext();
}
public T next()
{
return transform(_internalIterator.next());
}
public void remove()
{
_internalIterator.remove();
}
protected T transform(F element)
{
return getTransformer().transform(element);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy