# StreamSupport

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/java/util/stream/StreamSupport#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/stream/StreamSupport#inhmethods)  

# StreamSupport

`
public

final

class
StreamSupport
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|--------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.stream.StreamSupport |

<br />

*** ** * ** ***

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.

## Summary

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

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public methods

### doubleStream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static DoubleStream doubleStream (Spliterator.OfDouble 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://developer.android.com/reference/java/util/Spliterator.html#binding). Otherwise,[doubleStream(java.util.function.Supplier, int, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                  Parameters                                                                  ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------|
| `spliterator` | `Spliterator.OfDouble`: A`Spliterator.OfDouble`describing the stream elements <br />                                          |
| `parallel`    | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br /> |

|                                                                 Returns                                                                  ||
|---------------------------------------------------------------------------------------|---------------------------------------------------|
| [DoubleStream](https://developer.android.com/reference/java/util/stream/DoubleStream) | a new sequential or parallel`DoubleStream` <br /> |

### doubleStream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static DoubleStream doubleStream (Supplier<? extends Spliterator.OfDouble> supplier, 
                int characteristics, 
                boolean parallel)
```

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

The[Supplier.get()](https://developer.android.com/reference/java/util/function/Supplier#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://developer.android.com/reference/java/util/Spliterator.html#binding), it is likely more efficient to use[doubleStream(java.util.Spliterator.OfDouble, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                                                                      Parameters                                                                                                                       ||
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `supplier`        | `Supplier`: A`Supplier`of a`Spliterator.OfDouble` <br />                                                                                                                                                                           |
| `characteristics` | `int`: 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. <br /> |
| `parallel`        | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br />                                                                                                      |

|                                                                 Returns                                                                  ||
|---------------------------------------------------------------------------------------|---------------------------------------------------|
| [DoubleStream](https://developer.android.com/reference/java/util/stream/DoubleStream) | a new sequential or parallel`DoubleStream` <br /> |

**See also:**

- [doubleStream(java.util.Spliterator.OfDouble, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#doubleStream(java.util.Spliterator.OfDouble,%20boolean))  

### intStream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static IntStream intStream (Spliterator.OfInt 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://developer.android.com/reference/java/util/Spliterator.html#binding). Otherwise,[intStream(java.util.function.Supplier, int, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                  Parameters                                                                  ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------|
| `spliterator` | `Spliterator.OfInt`: a`Spliterator.OfInt`describing the stream elements <br />                                                |
| `parallel`    | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br /> |

|                                                             Returns                                                             ||
|---------------------------------------------------------------------------------|------------------------------------------------|
| [IntStream](https://developer.android.com/reference/java/util/stream/IntStream) | a new sequential or parallel`IntStream` <br /> |

### intStream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static IntStream intStream (Supplier<? extends Spliterator.OfInt> supplier, 
                int characteristics, 
                boolean parallel)
```

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

The[Supplier.get()](https://developer.android.com/reference/java/util/function/Supplier#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://developer.android.com/reference/java/util/Spliterator.html#binding), it is likely more efficient to use[intStream(java.util.Spliterator.OfInt, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                                                                     Parameters                                                                                                                     ||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `supplier`        | `Supplier`: a`Supplier`of a`Spliterator.OfInt` <br />                                                                                                                                                                           |
| `characteristics` | `int`: 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. <br /> |
| `parallel`        | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br />                                                                                                   |

|                                                             Returns                                                             ||
|---------------------------------------------------------------------------------|------------------------------------------------|
| [IntStream](https://developer.android.com/reference/java/util/stream/IntStream) | a new sequential or parallel`IntStream` <br /> |

**See also:**

- [intStream(java.util.Spliterator.OfInt, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#intStream(java.util.Spliterator.OfInt,%20boolean))  

### longStream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static LongStream longStream (Spliterator.OfLong 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://developer.android.com/reference/java/util/Spliterator.html#binding). Otherwise,[longStream(java.util.function.Supplier, int, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                  Parameters                                                                  ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------|
| `spliterator` | `Spliterator.OfLong`: a`Spliterator.OfLong`describing the stream elements <br />                                              |
| `parallel`    | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br /> |

|                                                              Returns                                                               ||
|-----------------------------------------------------------------------------------|-------------------------------------------------|
| [LongStream](https://developer.android.com/reference/java/util/stream/LongStream) | a new sequential or parallel`LongStream` <br /> |

### longStream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static LongStream longStream (Supplier<? extends Spliterator.OfLong> supplier, 
                int characteristics, 
                boolean parallel)
```

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

The[Supplier.get()](https://developer.android.com/reference/java/util/function/Supplier#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://developer.android.com/reference/java/util/Spliterator.html#binding), it is likely more efficient to use[longStream(java.util.Spliterator.OfLong, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                                                                     Parameters                                                                                                                      ||
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `supplier`        | `Supplier`: a`Supplier`of a`Spliterator.OfLong` <br />                                                                                                                                                                           |
| `characteristics` | `int`: 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. <br /> |
| `parallel`        | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br />                                                                                                    |

|                                                              Returns                                                               ||
|-----------------------------------------------------------------------------------|-------------------------------------------------|
| [LongStream](https://developer.android.com/reference/java/util/stream/LongStream) | a new sequential or parallel`LongStream` <br /> |

**See also:**

- [longStream(java.util.Spliterator.OfLong, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#longStream(java.util.Spliterator.OfLong,%20boolean))  

### stream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Stream<T> stream (Supplier<? extends Spliterator<T>> supplier, 
                int characteristics, 
                boolean parallel)
```

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

The[Supplier.get()](https://developer.android.com/reference/java/util/function/Supplier#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://developer.android.com/reference/java/util/Spliterator.html#binding), it is likely more efficient to use[stream(java.util.Spliterator, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                                                                  Parameters                                                                                                                  ||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `supplier`        | `Supplier`: a`Supplier`of a`Spliterator` <br />                                                                                                                                                                           |
| `characteristics` | `int`: Spliterator characteristics of the supplied`Spliterator`. The characteristics must be equal to`supplier.get().characteristics()`, otherwise undefined behavior may occur when terminal operation commences. <br /> |
| `parallel`        | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br />                                                                                             |

|                                                           Returns                                                           ||
|--------------------------------------------------------------------------------|---------------------------------------------|
| [Stream](https://developer.android.com/reference/java/util/stream/Stream)`<T>` | a new sequential or parallel`Stream` <br /> |

**See also:**

- [stream(java.util.Spliterator, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#stream(java.util.Spliterator<T>,%20boolean))  

### stream

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Stream<T> stream (Spliterator<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://developer.android.com/reference/java/util/Spliterator.html#binding). Otherwise,[stream(java.util.function.Supplier, int, boolean)](https://developer.android.com/reference/java/util/stream/StreamSupport#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://developer.android.com/reference/java/util/stream/package-summary#NonInterference)for more details.

<br />

|                                                                  Parameters                                                                  ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------|
| `spliterator` | `Spliterator`: a`Spliterator`describing the stream elements <br />                                                            |
| `parallel`    | `boolean`: if`true`then the returned stream is a parallel stream; if`false`the returned stream is a sequential stream. <br /> |

|                                                           Returns                                                           ||
|--------------------------------------------------------------------------------|---------------------------------------------|
| [Stream](https://developer.android.com/reference/java/util/stream/Stream)`<T>` | a new sequential or parallel`Stream` <br /> |