Example usage for java.util.stream StreamSupport longStream

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

Introduction

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

Prototype

public static LongStream longStream(Spliterator.OfLong spliterator, boolean parallel) 

Source Link

Document

Creates a new sequential or parallel LongStream from a Spliterator.OfLong .

Usage

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

@Override
public LongStream stream() {
    PrimitiveIterator.OfLong ofLong = new PrimitiveIterator.OfLong() {
        public int current = 0;

        @Override//from w w w  . j  ava  2s  . c o m
        public long nextLong() {
            return get(current++);
        }

        @Override
        public boolean hasNext() {
            return current < size();
        }
    };
    Spliterator.OfLong spliterator = Spliterators.spliterator(ofLong, size(), Spliterator.SIZED);
    return StreamSupport.longStream(spliterator, false);
}