org.securegraph.util.ConvertingIterable Maven / Gradle / Ivy
The newest version!
package org.securegraph.util;
import java.util.Iterator;
public abstract class ConvertingIterable implements Iterable {
private final Iterable iterable;
public ConvertingIterable(Iterable iterable) {
this.iterable = iterable;
}
@Override
public Iterator iterator() {
final Iterator it = iterable.iterator();
return new Iterator() {
@Override
public boolean hasNext() {
return it.hasNext();
}
@Override
public TDest next() {
return convert(it.next());
}
@Override
public void remove() {
it.remove();
}
};
}
protected abstract TDest convert(TSource o);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy