org.simpleflatmapper.util.TransformIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-util Show documentation
Show all versions of sfm-util Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.util;
import java.util.Iterator;
public final class TransformIterator implements Iterator {
private final Iterator it;
private final Function super I, ? extends O> transformer;
public TransformIterator(Iterator it, Function super I, ? extends O> transformer) {
this.it = it;
this.transformer = transformer;
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
@Override
public boolean hasNext() {
return it.hasNext();
}
@Override
public O next() {
return transformer.apply(it.next());
}
}