skadistats.clarity.util.SimpleIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clarity Show documentation
Show all versions of clarity Show documentation
Clarity is an open source replay parser for Dota 2, CSGO, CS2 and Deadlock written in Java.
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");
}
}