dev.marksman.enhancediterables.ProtectedIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enhanced-iterables Show documentation
Show all versions of enhanced-iterables Show documentation
Iterables with additional methods
package dev.marksman.enhancediterables;
import java.util.Iterator;
final class ProtectedIterator implements Iterator {
private final Iterator underlying;
private ProtectedIterator(Iterator underlying) {
this.underlying = underlying;
}
@Override
public boolean hasNext() {
return underlying.hasNext();
}
@Override
public A next() {
return underlying.next();
}
static ProtectedIterator protectedIterator(Iterator underlying) {
return new ProtectedIterator<>(underlying);
}
}