Example usage for java.util.stream StreamSupport doubleStream

List of usage examples for java.util.stream StreamSupport doubleStream

Introduction

In this page you can find the example usage for java.util.stream StreamSupport doubleStream.

Prototype

public static DoubleStream doubleStream(Spliterator.OfDouble spliterator, boolean parallel) 

Source Link

Document

Creates a new sequential or parallel DoubleStream from a Spliterator.OfDouble .

Usage

From source file:org.briljantframework.array.AbstractDoubleArray.java

@Override
public DoubleStream stream() {
    PrimitiveIterator.OfDouble ofDouble = new PrimitiveIterator.OfDouble() {
        public int current = 0;

        @Override/* w w  w . j av a 2 s  .c  o m*/
        public double nextDouble() {
            return get(current++);
        }

        @Override
        public boolean hasNext() {
            return current < size();
        }
    };

    Spliterator.OfDouble spliterator = Spliterators.spliterator(ofDouble, size(), Spliterator.SIZED);
    return StreamSupport.doubleStream(spliterator, false);
}