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

com.oneeyedmen.okeydoke.internal.LyingWrappingIterator Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package com.oneeyedmen.okeydoke.internal;

import java.util.Iterator;

public abstract class LyingWrappingIterator extends WrappingIterator {

    protected int i = 0;

    public LyingWrappingIterator(Iterator wrapped) {
        super(wrapped);
    }

    @Override
    public boolean hasNext() {
        return wrapped.hasNext() || hasNext(i);
    }

    protected abstract boolean hasNext(int i);

    @Override
    public T next() {
        try {
            return next(i);
        } finally {
            i++;
        }
    }

    protected abstract T next(int i);

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy