# BinaryOperator

public interface **BinaryOperator** implements [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<T, T, T\> Represents an operation upon two operands of the same type, producing a result
of the same type as the operands. This is a specialization of
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html` for the case where the operands and the result are all of
the same type.

This is a [functional interface](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/package-summary)
whose functional method is `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html#apply(T,%20U)`.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/UnaryOperator.html`

### Public Method Summary

|---|---|
| static \<T\> [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\> | [maxBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html#maxBy(java.util.Comparator<?%20super%20T>))([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator) Returns a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html` which returns the greater of two elements according to the specified `Comparator`. |
| static \<T\> [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\> | [minBy](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html#minBy(java.util.Comparator<?%20super%20T>))([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator) Returns a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html` which returns the lesser of two elements according to the specified `Comparator`. |

### Inherited Method Summary

From interface [java.util.function.BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)

|---|---|
| \<V\> [BiFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html)\<T, T, V\> | [andThen](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html#andThen(java.util.function.Function<?%20super%20R,%20?%20extends%20V>))([Function](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Function.html)\<? 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 | [apply](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiFunction.html#apply(T,%20U))(T t, T u) Applies this function to the given arguments. |

## Public Methods

#### public static [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\>
**maxBy**
([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator)

Returns a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html` which returns the greater of two elements
according to the specified `Comparator`.

##### Parameters

| comparator | a `Comparator` for comparing the two values |
|---|---|

##### Returns

- a `BinaryOperator` which returns the greater of its operands, according to the supplied `Comparator`

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the argument is null |
|---|---|

#### public static [BinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html)\<T\>
**minBy**
([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> comparator)

Returns a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BinaryOperator.html` which returns the lesser of two elements
according to the specified `Comparator`.

##### Parameters

| comparator | a `Comparator` for comparing the two values |
|---|---|

##### Returns

- a `BinaryOperator` which returns the lesser of its operands, according to the supplied `Comparator`

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the argument is null |
|---|---|