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/UnaryOperator#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/function/UnaryOperator#inhmethods)

# UnaryOperator


`
public


interface
UnaryOperator
`


`


implements

https://developer.android.com/reference/java/util/function/Function<T, T>


`

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

<br />

*** ** * ** ***

Represents an operation on a single operand that produces a result of the
same type as its operand. This is a specialization of `Function` for
the case where the operand and result are of the same type.

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/Function#apply(T)`.
**See also:**

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

## Summary

| ### Public methods ||
|---|---|
| ` static <T> https://developer.android.com/reference/java/util/function/UnaryOperator<T>` | ` https://developer.android.com/reference/java/util/function/UnaryOperator#identity()() ` Returns a unary operator that always returns its input argument. |

| ### Inherited methods |
|---|---|
| From interface ` https://developer.android.com/reference/java/util/function/Function ` |---|---| | ` default <V> https://developer.android.com/reference/java/util/function/Function<T, V>` | ` https://developer.android.com/reference/java/util/function/Function#andThen(java.util.function.Function<?%20super%20R,?%20extends%20V>)(https://developer.android.com/reference/java/util/function/Function<? super R, ? extends V> after) ` Returns a composed function that first applies this function to its input, and then applies the `after` function to the result. | | ` abstract T` | ` https://developer.android.com/reference/java/util/function/Function#apply(T)(T t) ` Applies this function to the given argument. | | ` default <V> https://developer.android.com/reference/java/util/function/Function<V, T>` | ` https://developer.android.com/reference/java/util/function/Function#compose(java.util.function.Function<?%20super%20V,?%20extends%20T>)(https://developer.android.com/reference/java/util/function/Function<? super V, ? extends T> before) ` Returns a composed function that first applies the `before` function to its input, and then applies this function to the result. | | ` static <T> https://developer.android.com/reference/java/util/function/Function<T, T>` | ` https://developer.android.com/reference/java/util/function/Function#identity()() ` Returns a function that always returns its input argument. | ||

## Public methods

### identity

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

```
public static UnaryOperator<T> identity ()
```

Returns a unary operator that always returns its input argument.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/function/UnaryOperator<T>` | a unary operator that always returns its input argument <br /> |