com.annimon.stream.PrimitiveIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stream Show documentation
Show all versions of stream Show documentation
Stream API from Java 8 rewritten on iterators for Java 7 and below
package com.annimon.stream;
import java.util.Iterator;
/**
* A base type for primitive specializations of {@code Iterator}. Specialized
* subtypes are provided for {@link OfInt int} values.
*/
public final class PrimitiveIterator {
private PrimitiveIterator() { }
public abstract static class OfInt implements Iterator {
public abstract int nextInt();
@Override
public Integer next() {
return nextInt();
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
}
public abstract static class OfLong implements Iterator {
public abstract long nextLong();
@Override
public Long next() {
return nextLong();
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
}
public abstract static class OfDouble implements Iterator {
public abstract double nextDouble();
@Override
public Double next() {
return nextDouble();
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
}
}