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

com.annimon.stream.PrimitiveIterator Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
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");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy