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

it.unitn.disi.smatch.data.trees.StartIterator Maven / Gradle / Ivy

The newest version!
package it.unitn.disi.smatch.data.trees;

import java.util.Iterator;

public class StartIterator implements Iterator {
    private E start;
    private Iterator i;

    public StartIterator(E start, Iterator i) {
        if (null == start) {
            throw new IllegalArgumentException("argument is null");
        }
        this.start = start;
        this.i = i;
    }

    public boolean hasNext() {
        return (null != start || i.hasNext());
    }

    public E next() {
        E result = start;
        if (null != start) {
            start = null;
        } else {
            result = i.next();
        }
        return result;
    }

    public void remove() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy