Example usage for java.util.stream StreamSupport intStream

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

Introduction

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

Prototype

public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) 

Source Link

Document

Creates a new sequential or parallel IntStream from a Spliterator.OfInt .

Usage

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

@Override
public IntStream stream() {
    PrimitiveIterator.OfInt ofInt = new PrimitiveIterator.OfInt() {
        private int current = 0;

        @Override//from  w w  w.  j a v a 2  s  .c  o m
        public int nextInt() {
            return get(current++);
        }

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

    };
    Spliterator.OfInt spliterator = Spliterators.spliterator(ofInt, size(), Spliterator.SIZED);
    return StreamSupport.intStream(spliterator, false);
}