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

solid.stream.Single Maven / Gradle / Ivy

package solid.stream;

import java.util.Iterator;

public class Single extends Stream {

    private T value;

    public Single(T value) {
        this.value = value;
    }

    @Override
    public Iterator iterator() {
        return new ReadOnlyIterator() {
            boolean hasNext = true;

            @Override
            public boolean hasNext() {
                return hasNext;
            }

            @Override
            public T next() {
                hasNext = false;
                return value;
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy