All Downloads are FREE. Search and download functionalities are using the official Maven repository.

skadistats.clarity.util.SimpleIterator Maven / Gradle / Ivy

Go to download

Clarity is an open source replay parser for Dota 2, CSGO, CS2 and Deadlock written in Java.

There is a newer version: 3.1.1
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy