com.oneeyedmen.okeydoke.internal.LyingWrappingIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of okeydoke Show documentation
Show all versions of okeydoke Show documentation
An approvals test library
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();
}
}