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

# LongConsumer

` public interface LongConsumer `   
` `

|---|
| java.util.function.LongConsumer |

Known indirect subclasses [LongStream.Builder](https://developer.android.com/reference/java/util/stream/LongStream.Builder), [LongSummaryStatistics](https://developer.android.com/reference/java/util/LongSummaryStatistics) [LongStream.Builder](https://developer.android.com/reference/java/util/stream/LongStream.Builder) A mutable builder for a `LongStream`. [LongSummaryStatistics](https://developer.android.com/reference/java/util/LongSummaryStatistics) A state object for collecting statistics such as count, min, max, sum, and average.   

*** ** * ** ***

Represents an operation that accepts a single `long`-valued argument and returns no result. This is the primitive type specialization of `https://developer.android.com/reference/java/util/function/Consumer` for `long`. Unlike most other functional interfaces, `LongConsumer` 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/LongConsumer#accept(long)`.
**See also:**

- `https://developer.android.com/reference/java/util/function/Consumer`

## Summary

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

Performs this operation on the given argument.

<br />

| Parameters ||
|---|---|
| `value` | `long`: the input argument <br /> |

### andThen

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

```
public LongConsumer andThen (LongConsumer after)
```

Returns a composed `LongConsumer` 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` | `LongConsumer`: the operation to perform after this operation <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/function/LongConsumer` | a composed `LongConsumer` 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 |