# BiFunction

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

# BiFunction

`
public


interface
BiFunction
`  
`


`

|------------------------------------------|
| java.util.function.BiFunction\<T, U, R\> |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)\<T\> |--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| | [BinaryOperator](https://developer.android.com/reference/java/util/function/BinaryOperator)\<T\> | Represents an operation upon two operands of the same type, producing a result of the same type as the operands. | |

<br />

*** ** * ** ***

Represents a function that accepts two arguments and produces a result. This is the two-arity specialization of[Function](https://developer.android.com/reference/java/util/function/Function).

This is a[functional interface](https://developer.android.com/reference/java/util/function/package-summary)whose functional method is[apply(java.lang.Object, java.lang.Object)](https://developer.android.com/reference/java/util/function/BiFunction#apply(T,%20U)).  
**See also:**

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

## Summary

|                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                    ||
|---------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` default <V> `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<T, U, V>` | ` `[andThen](https://developer.android.com/reference/java/util/function/BiFunction#andThen(java.util.function.Function<?%20super%20R,?%20extends%20V>))`(`[Function](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 R`                                                                                                 | ` `[apply](https://developer.android.com/reference/java/util/function/BiFunction#apply(T,%20U))`(T t, U u) ` Applies this function to the given arguments.                                                                                                                                                                                                                                                |

## Public methods

### andThen

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

```
public BiFunction<T, U, V> andThen (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. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.

<br />

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

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

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

### apply

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

```
public abstract R apply (T t, 
                U u)
```

Applies this function to the given arguments.

<br />

|                  Parameters                   ||
|-----|------------------------------------------|
| `t` | `T`: the first function argument <br />  |
| `u` | `U`: the second function argument <br /> |

|             Returns             ||
|-----|----------------------------|
| `R` | the function result <br /> |