Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Nested Classes](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator#nestedclasses) \| [Methods](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator#pubmethods)

# Gatherer.Integrator

` public static interface Gatherer.Integrator `   
` `

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

Known indirect subclasses [Gatherer.Integrator.Greedy](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy)\<A, T, R\> [Gatherer.Integrator.Greedy](https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy)\<A, T, R\> Greedy Integrators consume all their input, and may only relay that the downstream does not want more elements.   

*** ** * ** ***

An Integrator receives elements and processes them, optionally using the supplied state, and optionally sends incremental results downstream.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy<A, T, R>` Greedy Integrators consume all their input, and may only relay that the downstream does not want more elements. |

| ### Public methods ||
|---|---|
| ` abstract boolean` | ` https://developer.android.com/reference/java/util/stream/Gatherer.Integrator#integrate(A,%20T,%20java.util.stream.Gatherer.Downstream<?%20super%20R>)(A state, T element, https://developer.android.com/reference/java/util/stream/Gatherer.Downstream<? super R> downstream) ` Performs an action given: the current state, the next element, and a downstream object; potentially inspecting and/or updating the state, optionally sending any number of elements downstream -- and then returns whether more elements are to be consumed or not. |
| ` static <A, T, R> https://developer.android.com/reference/java/util/stream/Gatherer.Integrator<A, T, R>` | ` https://developer.android.com/reference/java/util/stream/Gatherer.Integrator#of(java.util.stream.Gatherer.Integrator<A,T,R>)(https://developer.android.com/reference/java/util/stream/Gatherer.Integrator<A, T, R> integrator) ` Factory method for turning Integrator-shaped lambdas into Integrators. |
| ` static <A, T, R> https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy<A, T, R>` | ` https://developer.android.com/reference/java/util/stream/Gatherer.Integrator#ofGreedy(java.util.stream.Gatherer.Integrator.Greedy<A,T,R>)(https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy<A, T, R> greedy) ` Factory method for turning Integrator-shaped lambdas into `https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy` Integrators. |

## Public methods

### integrate

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

```
public abstract boolean integrate (A state, 
                T element, 
                Downstream<? super R> downstream)
```

Performs an action given: the current state, the next element, and a downstream object; potentially inspecting and/or updating the state, optionally sending any number of elements downstream -- and then returns whether more elements are to be consumed or not.

<br />

| Parameters ||
|---|---|
| `state` | `A`: The state to integrate into <br /> |
| `element` | `T`: The element to integrate <br /> |
| `downstream` | `Downstream`: The downstream object of this integration <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if subsequent integration is desired, `false` if not <br /> |

### of

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

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

Factory method for turning Integrator-shaped lambdas into Integrators.

<br />

| Parameters ||
|---|---|
| `integrator` | `Integrator`: a lambda to create as Integrator <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/stream/Gatherer.Integrator<A, T, R>` | the given lambda as an Integrator <br /> |

### ofGreedy

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

```
public static Greedy<A, T, R> ofGreedy (Greedy<A, T, R> greedy)
```

Factory method for turning Integrator-shaped lambdas into `https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy` Integrators.

<br />

| Parameters ||
|---|---|
| `greedy` | `Greedy`: a lambda to create as Integrator.Greedy <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/stream/Gatherer.Integrator.Greedy<A, T, R>` | the given lambda as a Greedy Integrator <br /> |