StreamSupport (Java SE 10 & JDK 10 ) (original) (raw)
Method Detail
* #### stream
public static <T> [Stream](../../../java/util/stream/Stream.html "interface in java.util.stream")<T> stream([Spliterator](../../../java/util/Spliterator.html "interface in java.util")<T> spliterator,
boolean parallel)
Creates a new sequential or parallel `Stream` from a`Spliterator`.
The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences.
It is strongly recommended the spliterator report a characteristic of`IMMUTABLE` or `CONCURRENT`, or be[late-binding](../Spliterator.html#binding). Otherwise,[stream(java.util.function.Supplier, int, boolean)](../../../java/util/stream/StreamSupport.html#stream%28java.util.function.Supplier,int,boolean%29) should be used to reduce the scope of potential interference with the source. See[Non-Interference](package-summary.html#NonInterference) for more details.
Type Parameters:
`T` \- the type of stream elements
Parameters:
`spliterator` \- a `Spliterator` describing the stream elements
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `Stream`
* #### stream
public static <T> [Stream](../../../java/util/stream/Stream.html "interface in java.util.stream")<T> stream([Supplier](../../../java/util/function/Supplier.html "interface in java.util.function")<? extends [Spliterator](../../../java/util/Spliterator.html "interface in java.util")<T>> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel `Stream` from a`Supplier` of `Spliterator`.
The [Supplier.get()](../../../java/util/function/Supplier.html#get%28%29) method will be invoked on the supplier no more than once, and only after the terminal operation of the stream pipeline commences.
For spliterators that report a characteristic of `IMMUTABLE` or `CONCURRENT`, or that are[late-binding](../Spliterator.html#binding), it is likely more efficient to use [stream(java.util.Spliterator, boolean)](../../../java/util/stream/StreamSupport.html#stream%28java.util.Spliterator,boolean%29) instead.
The use of a `Supplier` in this form provides a level of indirection that reduces the scope of potential interference with the source. Since the supplier is only invoked after the terminal operation commences, any modifications to the source up to the start of the terminal operation are reflected in the stream result. See[Non-Interference](package-summary.html#NonInterference) for more details.
Type Parameters:
`T` \- the type of stream elements
Parameters:
`supplier` \- a `Supplier` of a `Spliterator`
`characteristics` \- Spliterator characteristics of the supplied`Spliterator`. The characteristics must be equal to`supplier.get().characteristics()`, otherwise undefined behavior may occur when terminal operation commences.
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `Stream`
See Also:
[stream(java.util.Spliterator, boolean)](../../../java/util/stream/StreamSupport.html#stream%28java.util.Spliterator,boolean%29)
* #### intStream
public static [IntStream](../../../java/util/stream/IntStream.html "interface in java.util.stream") intStream([Spliterator.OfInt](../../../java/util/Spliterator.OfInt.html "interface in java.util") spliterator,
boolean parallel)
Creates a new sequential or parallel `IntStream` from a`Spliterator.OfInt`.
The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences.
It is strongly recommended the spliterator report a characteristic of`IMMUTABLE` or `CONCURRENT`, or be[late-binding](../Spliterator.html#binding). Otherwise,[intStream(java.util.function.Supplier, int, boolean)](../../../java/util/stream/StreamSupport.html#intStream%28java.util.function.Supplier,int,boolean%29) should be used to reduce the scope of potential interference with the source. See[Non-Interference](package-summary.html#NonInterference) for more details.
Parameters:
`spliterator` \- a `Spliterator.OfInt` describing the stream elements
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `IntStream`
* #### intStream
public static [IntStream](../../../java/util/stream/IntStream.html "interface in java.util.stream") intStream([Supplier](../../../java/util/function/Supplier.html "interface in java.util.function")<? extends [Spliterator.OfInt](../../../java/util/Spliterator.OfInt.html "interface in java.util")> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel `IntStream` from a`Supplier` of `Spliterator.OfInt`.
The [Supplier.get()](../../../java/util/function/Supplier.html#get%28%29) method will be invoked on the supplier no more than once, and only after the terminal operation of the stream pipeline commences.
For spliterators that report a characteristic of `IMMUTABLE` or `CONCURRENT`, or that are[late-binding](../Spliterator.html#binding), it is likely more efficient to use [intStream(java.util.Spliterator.OfInt, boolean)](../../../java/util/stream/StreamSupport.html#intStream%28java.util.Spliterator.OfInt,boolean%29) instead.
The use of a `Supplier` in this form provides a level of indirection that reduces the scope of potential interference with the source. Since the supplier is only invoked after the terminal operation commences, any modifications to the source up to the start of the terminal operation are reflected in the stream result. See[Non-Interference](package-summary.html#NonInterference) for more details.
Parameters:
`supplier` \- a `Supplier` of a `Spliterator.OfInt`
`characteristics` \- Spliterator characteristics of the supplied`Spliterator.OfInt`. The characteristics must be equal to`supplier.get().characteristics()`, otherwise undefined behavior may occur when terminal operation commences.
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `IntStream`
See Also:
[intStream(java.util.Spliterator.OfInt, boolean)](../../../java/util/stream/StreamSupport.html#intStream%28java.util.Spliterator.OfInt,boolean%29)
* #### longStream
public static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream") longStream([Spliterator.OfLong](../../../java/util/Spliterator.OfLong.html "interface in java.util") spliterator,
boolean parallel)
Creates a new sequential or parallel `LongStream` from a`Spliterator.OfLong`.
The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences.
It is strongly recommended the spliterator report a characteristic of`IMMUTABLE` or `CONCURRENT`, or be[late-binding](../Spliterator.html#binding). Otherwise,[longStream(java.util.function.Supplier, int, boolean)](../../../java/util/stream/StreamSupport.html#longStream%28java.util.function.Supplier,int,boolean%29) should be used to reduce the scope of potential interference with the source. See[Non-Interference](package-summary.html#NonInterference) for more details.
Parameters:
`spliterator` \- a `Spliterator.OfLong` describing the stream elements
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `LongStream`
* #### longStream
public static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream") longStream([Supplier](../../../java/util/function/Supplier.html "interface in java.util.function")<? extends [Spliterator.OfLong](../../../java/util/Spliterator.OfLong.html "interface in java.util")> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel `LongStream` from a`Supplier` of `Spliterator.OfLong`.
The [Supplier.get()](../../../java/util/function/Supplier.html#get%28%29) method will be invoked on the supplier no more than once, and only after the terminal operation of the stream pipeline commences.
For spliterators that report a characteristic of `IMMUTABLE` or `CONCURRENT`, or that are[late-binding](../Spliterator.html#binding), it is likely more efficient to use [longStream(java.util.Spliterator.OfLong, boolean)](../../../java/util/stream/StreamSupport.html#longStream%28java.util.Spliterator.OfLong,boolean%29) instead.
The use of a `Supplier` in this form provides a level of indirection that reduces the scope of potential interference with the source. Since the supplier is only invoked after the terminal operation commences, any modifications to the source up to the start of the terminal operation are reflected in the stream result. See[Non-Interference](package-summary.html#NonInterference) for more details.
Parameters:
`supplier` \- a `Supplier` of a `Spliterator.OfLong`
`characteristics` \- Spliterator characteristics of the supplied`Spliterator.OfLong`. The characteristics must be equal to`supplier.get().characteristics()`, otherwise undefined behavior may occur when terminal operation commences.
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `LongStream`
See Also:
[longStream(java.util.Spliterator.OfLong, boolean)](../../../java/util/stream/StreamSupport.html#longStream%28java.util.Spliterator.OfLong,boolean%29)
* #### doubleStream
public static [DoubleStream](../../../java/util/stream/DoubleStream.html "interface in java.util.stream") doubleStream([Spliterator.OfDouble](../../../java/util/Spliterator.OfDouble.html "interface in java.util") spliterator,
boolean parallel)
Creates a new sequential or parallel `DoubleStream` from a`Spliterator.OfDouble`.
The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences.
It is strongly recommended the spliterator report a characteristic of`IMMUTABLE` or `CONCURRENT`, or be[late-binding](../Spliterator.html#binding). Otherwise,[doubleStream(java.util.function.Supplier, int, boolean)](../../../java/util/stream/StreamSupport.html#doubleStream%28java.util.function.Supplier,int,boolean%29) should be used to reduce the scope of potential interference with the source. See[Non-Interference](package-summary.html#NonInterference) for more details.
Parameters:
`spliterator` \- A `Spliterator.OfDouble` describing the stream elements
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `DoubleStream`
* #### doubleStream
public static [DoubleStream](../../../java/util/stream/DoubleStream.html "interface in java.util.stream") doubleStream([Supplier](../../../java/util/function/Supplier.html "interface in java.util.function")<? extends [Spliterator.OfDouble](../../../java/util/Spliterator.OfDouble.html "interface in java.util")> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel `DoubleStream` from a`Supplier` of `Spliterator.OfDouble`.
The [Supplier.get()](../../../java/util/function/Supplier.html#get%28%29) method will be invoked on the supplier no more than once, and only after the terminal operation of the stream pipeline commences.
For spliterators that report a characteristic of `IMMUTABLE` or `CONCURRENT`, or that are[late-binding](../Spliterator.html#binding), it is likely more efficient to use [doubleStream(java.util.Spliterator.OfDouble, boolean)](../../../java/util/stream/StreamSupport.html#doubleStream%28java.util.Spliterator.OfDouble,boolean%29) instead.
The use of a `Supplier` in this form provides a level of indirection that reduces the scope of potential interference with the source. Since the supplier is only invoked after the terminal operation commences, any modifications to the source up to the start of the terminal operation are reflected in the stream result. See[Non-Interference](package-summary.html#NonInterference) for more details.
Parameters:
`supplier` \- A `Supplier` of a `Spliterator.OfDouble`
`characteristics` \- Spliterator characteristics of the supplied`Spliterator.OfDouble`. The characteristics must be equal to`supplier.get().characteristics()`, otherwise undefined behavior may occur when terminal operation commences.
`parallel` \- if `true` then the returned stream is a parallel stream; if `false` the returned stream is a sequential stream.
Returns:
a new sequential or parallel `DoubleStream`
See Also:
[doubleStream(java.util.Spliterator.OfDouble, boolean)](../../../java/util/stream/StreamSupport.html#doubleStream%28java.util.Spliterator.OfDouble,boolean%29)