
skadistats.clarity.util.SimpleIterator Maven / Gradle / Ivy
package skadistats.clarity.util;
import java.util.Iterator;
import java.util.NoSuchElementException;
public abstract class SimpleIterator implements Iterator {
private T v = null;
private Boolean next = null;
public abstract T readNext();
@Override
public boolean hasNext() {
if (next == null) {
v = readNext();
next = v != null;
}
return next.booleanValue(); }
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
next = null;
return v;
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy