# IntStream.Builder

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/IntStream.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/stream/IntStream.Builder#inhmethods)  

# IntStream.Builder

`
public
static


interface
IntStream.Builder
`  
`


implements

`[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)`


`

|------------------------------------|
| java.util.stream.IntStream.Builder |

<br />

*** ** * ** ***

A mutable builder for an`IntStream`.

A stream builder has a lifecycle, which starts in a building phase, during which elements can be added, and then transitions to a built phase, after which elements may not be added. The built phase begins when the[build()](https://developer.android.com/reference/java/util/stream/IntStream.Builder#build())method is called, which creates an ordered stream whose elements are the elements that were added to the stream builder, in the order they were added.  
**See also:**

- [IntStream.builder()](https://developer.android.com/reference/java/util/stream/IntStream#builder())

## Summary

|                                                                                                                                ### Public methods                                                                                                                                 ||
|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void`                                                                                           | ` `[accept](https://developer.android.com/reference/java/util/stream/IntStream.Builder#accept(int))`(int t) ` Adds an element to the stream being built.              |
| ` default `[IntStream.Builder](https://developer.android.com/reference/java/util/stream/IntStream.Builder) | ` `[add](https://developer.android.com/reference/java/util/stream/IntStream.Builder#add(int))`(int t) ` Adds an element to the stream being built.                    |
| ` abstract `[IntStream](https://developer.android.com/reference/java/util/stream/IntStream)                | ` `[build](https://developer.android.com/reference/java/util/stream/IntStream.Builder#build())`() ` Builds the stream, transitioning this builder to the built state. |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[java.util.function.IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)` ` |--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void`                                                                                 | ` `[accept](https://developer.android.com/reference/java/util/function/IntConsumer#accept(int))`(int value) ` Performs this operation on the given argument.                                                                                                                                                                              | | ` default `[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer) | ` `[andThen](https://developer.android.com/reference/java/util/function/IntConsumer#andThen(java.util.function.IntConsumer))`(`[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)` after) ` Returns a composed`IntConsumer`that performs, in sequence, this operation followed by the`after`operation. | ||

## Public methods

### accept

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

```
public abstract void accept (int t)
```

Adds an element to the stream being built.

<br />

|              Parameters               ||
|-----|----------------------------------|
| `t` | `int`: the input argument <br /> |

|                                                                            Throws                                                                            ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if the builder has already transitioned to the built state |

### add

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

```
public IntStream.Builder add (int t)
```

Adds an element to the stream being built.

<br />

##### Implementation Requirements:

- The default implementation behaves as if:  

      accept(t)
           return this;
       
|              Parameters               ||
|-----|----------------------------------|
| `t` | `int`: the element to add <br /> |

|                                                        Returns                                                        ||
|-------------------------------------------------------------------------------------------------|----------------------|
| [IntStream.Builder](https://developer.android.com/reference/java/util/stream/IntStream.Builder) | `this`builder <br /> |

|                                                                            Throws                                                                            ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if the builder has already transitioned to the built state |

### build

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

```
public abstract IntStream build ()
```

Builds the stream, transitioning this builder to the built state. An`IllegalStateException`is thrown if there are further attempts to operate on the builder after it has entered the built state.

<br />

|                                                 Returns                                                  ||
|---------------------------------------------------------------------------------|-------------------------|
| [IntStream](https://developer.android.com/reference/java/util/stream/IntStream) | the built stream <br /> |

|                                                                            Throws                                                                            ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if the builder has already transitioned to the built state |