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/function/Consumer#pubmethods)

# Consumer

` public interface Consumer `   
` `

|---|
| java.util.function.Consumer\<T\> |

Known indirect subclasses [Stream.Builder](https://developer.android.com/reference/java/util/stream/Stream.Builder)\<T\> [Stream.Builder](https://developer.android.com/reference/java/util/stream/Stream.Builder)\<T\> A mutable builder for a `Stream`.   

*** ** * ** ***

Represents an operation that accepts a single input argument and returns no result. Unlike most other functional interfaces, `Consumer` is expected to operate via side-effects.

This is a [functional interface](https://developer.android.com/reference/java/util/function/package-summary) whose functional method is `https://developer.android.com/reference/java/util/function/Consumer#accept(T)`.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/java/util/function/Consumer#accept(T)(T t) ` Performs this operation on the given argument. |
| ` default https://developer.android.com/reference/java/util/function/Consumer<T>` | ` https://developer.android.com/reference/java/util/function/Consumer#andThen(java.util.function.Consumer<?%20super%20T>)(https://developer.android.com/reference/java/util/function/Consumer<? super T> after) ` Returns a composed `Consumer` 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 (T t)
```

Performs this operation on the given argument.

<br />

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

### andThen

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

```
public Consumer<T> andThen (Consumer<? super T> after)
```

Returns a composed `Consumer` that performs, in sequence, this operation followed by the `after` operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the `after` operation will not be performed.

<br />

| Parameters ||
|---|---|
| `after` | `Consumer`: the operation to perform after this operation <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/function/Consumer<T>` | a composed `Consumer` that performs in sequence this operation followed by the `after` operation <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `after` is null |