# Gatherer

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

# Gatherer

`
public


interface
Gatherer
`  
`


`

|--------------------------------------|
| java.util.stream.Gatherer\<T, A, R\> |

<br />

*** ** * ** ***

An intermediate operation that transforms a stream of input elements into a stream of output elements, optionally applying a final action when the end of the upstream is reached. The transformation may be stateless or stateful, and may buffer input before producing any output.

Gatherer operations can be performed either sequentially, or be parallelized -- if a combiner function is supplied.

There are many examples of gathering operations, including but not limited to: grouping elements into batches (windowing functions); de-duplicating consecutively similar elements; incremental accumulation functions (prefix scan); incremental reordering functions, etc. The class[Gatherers](https://developer.android.com/reference/java/util/stream/Gatherers)provides implementations of common gathering operations.  
**See also:**

- [Stream.gather(Gatherer)](https://developer.android.com/reference/java/util/stream/Stream#gather(java.util.stream.Gatherer<?%20super%20T,?,R>))
- [Gatherers](https://developer.android.com/reference/java/util/stream/Gatherers)

## Summary

|                                                                                                                             ### Nested classes                                                                                                                             ||
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [Gatherer.Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<T>` A Downstream object is the next stage in a pipeline of operations, to which elements can be sent.                                                   |
| ` interface` | [Gatherer.Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<A, T, R>` An Integrator receives elements and processes them, optionally using the supplied state, and optionally sends incremental results downstream. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` default <RR> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, ?, RR>`                                                                                                          | ` `[andThen](https://developer.android.com/reference/java/util/stream/Gatherer#andThen(java.util.stream.Gatherer<?%20super%20R,?,?%20extends%20RR>))`(`[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<? super R, ?, ? extends RR> that) ` Returns a composed Gatherer which connects the output of this Gatherer to the input of that Gatherer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` default `[BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)`<A>`                                                                                                        | ` `[combiner](https://developer.android.com/reference/java/util/stream/Gatherer#combiner())`() ` A function which accepts two intermediate states and combines them into one.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` static <A> `[BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)`<A>`                                                                                                     | ` `[defaultCombiner](https://developer.android.com/reference/java/util/stream/Gatherer#defaultCombiner())`() ` Returns a combiner which is the default combiner of a Gatherer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` static <A, R> `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<A, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>>` | ` `[defaultFinisher](https://developer.android.com/reference/java/util/stream/Gatherer#defaultFinisher())`() ` Returns a`finisher`which is the default finisher of a`Gatherer`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static <A> `[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A>`                                                                                                                 | ` `[defaultInitializer](https://developer.android.com/reference/java/util/stream/Gatherer#defaultInitializer())`() ` Returns an initializer which is the default initializer of a Gatherer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` default `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<A, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>>`       | ` `[finisher](https://developer.android.com/reference/java/util/stream/Gatherer#finisher())`() ` A function which accepts the final intermediate state and a[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)object, allowing to perform a final action at the end of input elements.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` default `[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A>`                                                                                                                    | ` `[initializer](https://developer.android.com/reference/java/util/stream/Gatherer#initializer())`() ` A function that produces an instance of the intermediate state used for this gathering operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` abstract `[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<A, T, R>`                                                                                                  | ` `[integrator](https://developer.android.com/reference/java/util/stream/Gatherer#integrator())`() ` A function which integrates provided elements, potentially using the provided intermediate state, optionally producing output to the provided[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` static <T, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>`                                           | ` `[of](https://developer.android.com/reference/java/util/stream/Gatherer#of(java.util.stream.Gatherer.Integrator<java.lang.Void,T,R>))`(`[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<`[Void](https://developer.android.com/reference/java/lang/Void)`, T, R> integrator) ` Returns a new, parallelizable, and stateless`Gatherer`described by the given`integrator`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` static <T, A, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, A, R>`                                                                                                       | ` `[of](https://developer.android.com/reference/java/util/stream/Gatherer#of(java.util.function.Supplier<A>,%20java.util.stream.Gatherer.Integrator<A,T,R>,%20java.util.function.BinaryOperator<A>,%20java.util.function.BiConsumer<A,java.util.stream.Gatherer.Downstream<?%20super%20R>>))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A> initializer, `[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<A, T, R> integrator, `[BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)`<A> combiner, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<A, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>> finisher) ` Returns a new, parallelizable,`Gatherer`described by the given`initializer`,`integrator`,`combiner`and`finisher`. |
| ` static <T, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>`                                           | ` `[of](https://developer.android.com/reference/java/util/stream/Gatherer#of(java.util.stream.Gatherer.Integrator<java.lang.Void,T,R>,%20java.util.function.BiConsumer<java.lang.Void,java.util.stream.Gatherer.Downstream<?%20super%20R>>))`(`[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<`[Void](https://developer.android.com/reference/java/lang/Void)`, T, R> integrator, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<`[Void](https://developer.android.com/reference/java/lang/Void)`, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>> finisher) ` Returns a new, parallelizable, and stateless`Gatherer`described by the given`integrator`and`finisher`.                                                                                                                                           |
| ` static <T, A, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, A, R>`                                                                                                       | ` `[ofSequential](https://developer.android.com/reference/java/util/stream/Gatherer#ofSequential(java.util.function.Supplier<A>,%20java.util.stream.Gatherer.Integrator<A,T,R>))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A> initializer, `[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<A, T, R> integrator) ` Returns a new, sequential,`Gatherer`described by the given`initializer`and`integrator`.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static <T, A, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, A, R>`                                                                                                       | ` `[ofSequential](https://developer.android.com/reference/java/util/stream/Gatherer#ofSequential(java.util.function.Supplier<A>,%20java.util.stream.Gatherer.Integrator<A,T,R>,%20java.util.function.BiConsumer<A,java.util.stream.Gatherer.Downstream<?%20super%20R>>))`(`[Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A> initializer, `[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<A, T, R> integrator, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<A, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>> finisher) ` Returns a new, sequential,`Gatherer`described by the given`initializer`,`integrator`, and`finisher`.                                                                                                                                             |
| ` static <T, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>`                                           | ` `[ofSequential](https://developer.android.com/reference/java/util/stream/Gatherer#ofSequential(java.util.stream.Gatherer.Integrator<java.lang.Void,T,R>,%20java.util.function.BiConsumer<java.lang.Void,java.util.stream.Gatherer.Downstream<?%20super%20R>>))`(`[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<`[Void](https://developer.android.com/reference/java/lang/Void)`, T, R> integrator, `[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<`[Void](https://developer.android.com/reference/java/lang/Void)`, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>> finisher) ` Returns a new, sequential, and stateless`Gatherer`described by the given`integrator`and`finisher`.                                                                                                                           |
| ` static <T, R> `[Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>`                                           | ` `[ofSequential](https://developer.android.com/reference/java/util/stream/Gatherer#ofSequential(java.util.stream.Gatherer.Integrator<java.lang.Void,T,R>))`(`[Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<`[Void](https://developer.android.com/reference/java/lang/Void)`, T, R> integrator) ` Returns a new, sequential, and stateless`Gatherer`described by the given`integrator`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

## Public methods

### andThen

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public Gatherer<T, ?, RR> andThen (Gatherer<? super R, ?, ? extends RR> that)
```

Returns a composed Gatherer which connects the output of this Gatherer to the input of that Gatherer.

<br />

##### Implementation Requirements:

- The implementation in this interface returns a new Gatherer which is semantically equivalent to the combination of`this`and`that`gatherer.

|                  Parameters                   ||
|--------|---------------------------------------|
| `that` | `Gatherer`: the other gatherer <br /> |

|                                                                                             Returns                                                                                             ||
|-------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, ?, RR>` | returns a composed Gatherer which connects the output of this Gatherer as input that Gatherer <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the argument is`null` |

### combiner

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public BinaryOperator<A> combiner ()
```

A function which accepts two intermediate states and combines them into one.

<br />

##### Implementation Requirements:

- The implementation in this interface returns[defaultCombiner()](https://developer.android.com/reference/java/util/stream/Gatherer#defaultCombiner()).

|                                                                                       Returns                                                                                        ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)`<A>` | a function which accepts two intermediate states and combines them into one <br /> |

### defaultCombiner

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static BinaryOperator<A> defaultCombiner ()
```

Returns a combiner which is the default combiner of a Gatherer. The returned combiner identifies that the owning Gatherer must only be evaluated sequentially.

<br />

##### Implementation Requirements:

- This method always returns the same instance.

|                                                                    Returns                                                                    ||
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)`<A>` | the instance of the default combiner <br /> |

**See also:**

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

### defaultFinisher

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static BiConsumer<A, Downstream<? super R>> defaultFinisher ()
```

Returns a`finisher`which is the default finisher of a`Gatherer`. The returned finisher identifies that the owning Gatherer performs no additional actions at the end of input.

<br />

##### Implementation Requirements:

- This method always returns the same instance.

|                                                                                                                    Returns                                                                                                                     ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|
| [BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<A, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>>` | the instance of the default finisher <br /> |

**See also:**

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

### defaultInitializer

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Supplier<A> defaultInitializer ()
```

Returns an initializer which is the default initializer of a Gatherer. The returned initializer identifies that the owner Gatherer is stateless.

<br />

##### Implementation Requirements:

- This method always returns the same instance.

|                                                               Returns                                                                ||
|--------------------------------------------------------------------------------------|------------------------------------------------|
| [Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A>` | the instance of the default initializer <br /> |

**See also:**

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

### finisher

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public BiConsumer<A, Downstream<? super R>> finisher ()
```

A function which accepts the final intermediate state and a[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)object, allowing to perform a final action at the end of input elements.

<br />

##### Implementation Requirements:

- The implementation in this interface returns[defaultFinisher()](https://developer.android.com/reference/java/util/stream/Gatherer#defaultFinisher()).

|                                                                                                                                                                 Returns                                                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| [BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<A, `[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream)`<? super R>>` | a function which transforms the intermediate result to the final result(s) which are then passed on to the provided Downstream <br /> |

### initializer

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public Supplier<A> initializer ()
```

A function that produces an instance of the intermediate state used for this gathering operation.

<br />

##### Implementation Requirements:

- The implementation in this interface returns[defaultInitializer()](https://developer.android.com/reference/java/util/stream/Gatherer#defaultInitializer()).

|                                                                                            Returns                                                                                            ||
|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| [Supplier](https://developer.android.com/reference/java/util/function/Supplier)`<A>` | A function that produces an instance of the intermediate state used for this gathering operation <br /> |

### integrator

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public abstract Integrator<A, T, R> integrator ()
```

A function which integrates provided elements, potentially using the provided intermediate state, optionally producing output to the provided[Downstream](https://developer.android.com/reference/java/util/stream/Gatherer.Downstream).

<br />

|                                                                                                                          Returns                                                                                                                          ||
|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| [Integrator](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator)`<A, T, R>` | a function which integrates provided elements, potentially using the provided state, optionally producing output to the provided Downstream <br /> |

### of

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, Void, R> of (Integrator<Void, T, R> integrator)
```

Returns a new, parallelizable, and stateless`Gatherer`described by the given`integrator`.

<br />

|                                   Parameters                                    ||
|--------------|-------------------------------------------------------------------|
| `integrator` | `Integrator`: the integrator function for the new gatherer <br /> |

|                                                                                      Returns                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any argument is`null` |

### of

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, A, R> of (Supplier<A> initializer, 
                Integrator<A, T, R> integrator, 
                BinaryOperator<A> combiner, 
                BiConsumer<A, Downstream<? super R>> finisher)
```

Returns a new, parallelizable,`Gatherer`described by the given`initializer`,`integrator`,`combiner`and`finisher`.

<br />

|                                     Parameters                                     ||
|---------------|---------------------------------------------------------------------|
| `initializer` | `Supplier`: the initializer function for the new gatherer <br />    |
| `integrator`  | `Integrator`: the integrator function for the new gatherer <br />   |
| `combiner`    | `BinaryOperator`: the combiner function for the new gatherer <br /> |
| `finisher`    | `BiConsumer`: the finisher function for the new gatherer <br />     |

|                                                      Returns                                                       ||
|------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, A, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any argument is`null` |

### of

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, Void, R> of (Integrator<Void, T, R> integrator, 
                BiConsumer<Void, Downstream<? super R>> finisher)
```

Returns a new, parallelizable, and stateless`Gatherer`described by the given`integrator`and`finisher`.

<br />

|                                   Parameters                                    ||
|--------------|-------------------------------------------------------------------|
| `integrator` | `Integrator`: the integrator function for the new gatherer <br /> |
| `finisher`   | `BiConsumer`: the finisher function for the new gatherer <br />   |

|                                                                                      Returns                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any argument is`null` |

### ofSequential

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, A, R> ofSequential (Supplier<A> initializer, 
                Integrator<A, T, R> integrator)
```

Returns a new, sequential,`Gatherer`described by the given`initializer`and`integrator`.

<br />

|                                    Parameters                                    ||
|---------------|-------------------------------------------------------------------|
| `initializer` | `Supplier`: the initializer function for the new gatherer <br />  |
| `integrator`  | `Integrator`: the integrator function for the new gatherer <br /> |

|                                                      Returns                                                       ||
|------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, A, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any argument is`null` |

### ofSequential

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, A, R> ofSequential (Supplier<A> initializer, 
                Integrator<A, T, R> integrator, 
                BiConsumer<A, Downstream<? super R>> finisher)
```

Returns a new, sequential,`Gatherer`described by the given`initializer`,`integrator`, and`finisher`.

<br />

|                                    Parameters                                    ||
|---------------|-------------------------------------------------------------------|
| `initializer` | `Supplier`: the initializer function for the new gatherer <br />  |
| `integrator`  | `Integrator`: the integrator function for the new gatherer <br /> |
| `finisher`    | `BiConsumer`: the finisher function for the new gatherer <br />   |

|                                                      Returns                                                       ||
|------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, A, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any argument is`null` |

### ofSequential

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, Void, R> ofSequential (Integrator<Void, T, R> integrator, 
                BiConsumer<Void, Downstream<? super R>> finisher)
```

Returns a new, sequential, and stateless`Gatherer`described by the given`integrator`and`finisher`.

<br />

|                                   Parameters                                    ||
|--------------|-------------------------------------------------------------------|
| `integrator` | `Integrator`: the integrator function for the new gatherer <br /> |
| `finisher`   | `BiConsumer`: the finisher function for the new gatherer <br />   |

|                                                                                      Returns                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any argument is`null` |

### ofSequential

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static Gatherer<T, Void, R> ofSequential (Integrator<Void, T, R> integrator)
```

Returns a new, sequential, and stateless`Gatherer`described by the given`integrator`.

<br />

|                                   Parameters                                    ||
|--------------|-------------------------------------------------------------------|
| `integrator` | `Integrator`: the integrator function for the new gatherer <br /> |

|                                                                                      Returns                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [Gatherer](https://developer.android.com/reference/java/util/stream/Gatherer)`<T, `[Void](https://developer.android.com/reference/java/lang/Void)`, R>` | the new`Gatherer` <br /> |

|                                                          Throws                                                          ||
|------------------------------------------------------------------------------------------------|--------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the argument is`null` |