# StreamSupport

public final class **StreamSupport** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Low-level utility methods for creating and manipulating streams.

This class is mostly for library writers presenting stream views
of data structures; most static stream methods intended for end users are in
the various `Stream` classes.

### Public Method Summary

|---|---|
| static [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html) | [doubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#doubleStream(java.util.Spliterator.OfDouble,%20boolean))([Spliterator.OfDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfDouble.html) spliterator, boolean parallel) Creates a new sequential or parallel `DoubleStream` from a `Spliterator.OfDouble`. |
| static [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html) | [doubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#doubleStream(java.util.function.Supplier<?%20extends%20java.util.Spliterator.OfDouble>,%20int,%20boolean))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator.OfDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfDouble.html)\> supplier, int characteristics, boolean parallel) Creates a new sequential or parallel `DoubleStream` from a `Supplier` of `Spliterator.OfDouble`. |
| static [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html) | [intStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#intStream(java.util.Spliterator.OfInt,%20boolean))([Spliterator.OfInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfInt.html) spliterator, boolean parallel) Creates a new sequential or parallel `IntStream` from a `Spliterator.OfInt`. |
| static [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html) | [intStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#intStream(java.util.function.Supplier<?%20extends%20java.util.Spliterator.OfInt>,%20int,%20boolean))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator.OfInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfInt.html)\> supplier, int characteristics, boolean parallel) Creates a new sequential or parallel `IntStream` from a `Supplier` of `Spliterator.OfInt`. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [longStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#longStream(java.util.Spliterator.OfLong,%20boolean))([Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html) spliterator, boolean parallel) Creates a new sequential or parallel `LongStream` from a `Spliterator.OfLong`. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [longStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#longStream(java.util.function.Supplier<?%20extends%20java.util.Spliterator.OfLong>,%20int,%20boolean))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html)\> supplier, int characteristics, boolean parallel) Creates a new sequential or parallel `LongStream` from a `Supplier` of `Spliterator.OfLong`. |
| static \<T\> [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<T\> | [stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#stream(java.util.Spliterator<T>,%20boolean))([Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<T\> spliterator, boolean parallel) Creates a new sequential or parallel `Stream` from a `Spliterator`. |
| static \<T\> [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<T\> | [stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#stream(java.util.function.Supplier<?%20extends%20java.util.Spliterator<T>>,%20int,%20boolean))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<T\>\> supplier, int characteristics, boolean parallel) Creates a new sequential or parallel `Stream` from a `Supplier` of `Spliterator`. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Methods

#### public static [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html)
**doubleStream**
([Spliterator.OfDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfDouble.html) 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding). Otherwise,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#doubleStream(java.util.function.Supplier<?%20extends%20java.util.Spliterator.OfDouble>,%20int,%20boolean)` should
be used to reduce the scope of potential interference with the source. See
[Non-Interference](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#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`

#### public static [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html)
**doubleStream**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator.OfDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfDouble.html)\> supplier, int characteristics, boolean parallel)

Creates a new sequential or parallel `DoubleStream` from a
`Supplier` of `Spliterator.OfDouble`.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html#get()` 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding), it is likely
more efficient to use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#doubleStream(java.util.Spliterator.OfDouble,%20boolean)`
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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#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

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#doubleStream(java.util.Spliterator.OfDouble,%20boolean)`

#### public static [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html)
**intStream**
([Spliterator.OfInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfInt.html) 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding). Otherwise,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#intStream(java.util.function.Supplier<?%20extends%20java.util.Spliterator.OfInt>,%20int,%20boolean)` should be
used to reduce the scope of potential interference with the source. See
[Non-Interference](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#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`

#### public static [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html)
**intStream**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator.OfInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfInt.html)\> supplier, int characteristics, boolean parallel)

Creates a new sequential or parallel `IntStream` from a
`Supplier` of `Spliterator.OfInt`.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html#get()` 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding), it is likely
more efficient to use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#intStream(java.util.Spliterator.OfInt,%20boolean)`
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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#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

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#intStream(java.util.Spliterator.OfInt,%20boolean)`

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**longStream**
([Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html) 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding). Otherwise,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#longStream(java.util.function.Supplier<?%20extends%20java.util.Spliterator.OfLong>,%20int,%20boolean)` should be
used to reduce the scope of potential interference with the source. See
[Non-Interference](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#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`

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**longStream**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html)\> supplier, int characteristics, boolean parallel)

Creates a new sequential or parallel `LongStream` from a
`Supplier` of `Spliterator.OfLong`.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html#get()` 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding), it is likely
more efficient to use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#longStream(java.util.Spliterator.OfLong,%20boolean)`
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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#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

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#longStream(java.util.Spliterator.OfLong,%20boolean)`

#### public static [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<T\>
**stream**
([Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding). Otherwise,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#stream(java.util.function.Supplier<?%20extends%20java.util.Spliterator<T>>,%20int,%20boolean)` should be used
to reduce the scope of potential interference with the source. See
[Non-Interference](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference) for
more details.

##### 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`

#### public static [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<T\>
**stream**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<? extends [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<T\>\> supplier, int characteristics, boolean parallel)

Creates a new sequential or parallel `Stream` from a
`Supplier` of `Spliterator`.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html#get()` 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#binding), it is likely
more efficient to use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#stream(java.util.Spliterator<T>,%20boolean)`
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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference) for
more details.

##### 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

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/StreamSupport.html#stream(java.util.Spliterator<T>,%20boolean)`