# LongUnaryOperator

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

# LongUnaryOperator

`
public


interface
LongUnaryOperator
`  
`


`

|--------------------------------------|
| java.util.function.LongUnaryOperator |

<br />

*** ** * ** ***

Represents an operation on a single`long`-valued operand that produces a`long`-valued result. This is the primitive type specialization of[UnaryOperator](https://developer.android.com/reference/java/util/function/UnaryOperator)for`long`.

This is a[functional interface](https://developer.android.com/reference/java/util/function/package-summary)whose functional method is[applyAsLong(long)](https://developer.android.com/reference/java/util/function/LongUnaryOperator#applyAsLong(long)).  
**See also:**

- [UnaryOperator](https://developer.android.com/reference/java/util/function/UnaryOperator)

## Summary

|                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` default `[LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator) | ` `[andThen](https://developer.android.com/reference/java/util/function/LongUnaryOperator#andThen(java.util.function.LongUnaryOperator))`(`[LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator)` after) ` Returns a composed operator that first applies this operator to its input, and then applies the`after`operator to the result.   |
| ` abstract long`                                                                                             | ` `[applyAsLong](https://developer.android.com/reference/java/util/function/LongUnaryOperator#applyAsLong(long))`(long operand) ` Applies this operator to the given operand.                                                                                                                                                                                                          |
| ` default `[LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator) | ` `[compose](https://developer.android.com/reference/java/util/function/LongUnaryOperator#compose(java.util.function.LongUnaryOperator))`(`[LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator)` before) ` Returns a composed operator that first applies the`before`operator to its input, and then applies this operator to the result. |
| ` static `[LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator)  | ` `[identity](https://developer.android.com/reference/java/util/function/LongUnaryOperator#identity())`() ` Returns a unary operator that always returns its input argument.                                                                                                                                                                                                           |

## Public methods

### andThen

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

```
public LongUnaryOperator andThen (LongUnaryOperator after)
```

Returns a composed operator that first applies this operator to its input, and then applies the`after`operator to the result. If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.

<br />

|                                        Parameters                                         ||
|---------|----------------------------------------------------------------------------------|
| `after` | `LongUnaryOperator`: the operator to apply after this operator is applied <br /> |

|                                                                                              Returns                                                                                               ||
|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| [LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator) | a composed operator that first applies this operator and then applies the`after`operator <br /> |

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

**See also:**

- [compose(LongUnaryOperator)](https://developer.android.com/reference/java/util/function/LongUnaryOperator#compose(java.util.function.LongUnaryOperator))  

### applyAsLong

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

```
public abstract long applyAsLong (long operand)
```

Applies this operator to the given operand.

<br />

|              Parameters               ||
|-----------|----------------------------|
| `operand` | `long`: the operand <br /> |

|              Returns               ||
|--------|----------------------------|
| `long` | the operator result <br /> |

### compose

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

```
public LongUnaryOperator compose (LongUnaryOperator before)
```

Returns a composed operator that first applies the`before`operator to its input, and then applies this operator to the result. If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.

<br />

|                                         Parameters                                          ||
|----------|-----------------------------------------------------------------------------------|
| `before` | `LongUnaryOperator`: the operator to apply before this operator is applied <br /> |

|                                                                                               Returns                                                                                               ||
|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator) | a composed operator that first applies the`before`operator and then applies this operator <br /> |

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

**See also:**

- [andThen(LongUnaryOperator)](https://developer.android.com/reference/java/util/function/LongUnaryOperator#andThen(java.util.function.LongUnaryOperator))  

### identity

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

```
public static LongUnaryOperator identity ()
```

Returns a unary operator that always returns its input argument.

<br />

|                                                                              Returns                                                                              ||
|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
| [LongUnaryOperator](https://developer.android.com/reference/java/util/function/LongUnaryOperator) | a unary operator that always returns its input argument <br /> |