Most visited

Recently visited

Added in API level 24

BinaryOperator

public interface BinaryOperator
implements BiFunction<T, T, T>

java.util.function.BinaryOperator<T>


表示对两个相同类型操作数的操作,生成与操作数相同类型的结果。 对于操作数和结果都是相同类型的情况,这是BiFunction的专门化。

这是一个 functional interface,其功能方法是 apply(Object, Object)

也可以看看:

Summary

Public methods

static <T> BinaryOperator<T> maxBy(Comparator<? super T> comparator)

返回一个 BinaryOperator ,它根据指定的 Comparator返回两个元素中较大的 Comparator

static <T> BinaryOperator<T> minBy(Comparator<? super T> comparator)

返回一个 BinaryOperator ,它根据指定的 Comparator返回两个元素中较小的 Comparator

Inherited methods

From interface java.util.function.BiFunction

Public methods

maxBy

Added in API level 24
BinaryOperator<T> maxBy (Comparator<? super T> comparator)

返回 BinaryOperator ,根据指定的 Comparator返回两个元素中较大的 Comparator

Parameters
comparator Comparator: a Comparator for comparing the two values
Returns
BinaryOperator<T> a BinaryOperator which returns the greater of its operands, according to the supplied Comparator
Throws
NullPointerException if the argument is null

minBy

Added in API level 24
BinaryOperator<T> minBy (Comparator<? super T> comparator)

返回一个 BinaryOperator ,它根据指定的 Comparator返回两个元素中较小的 Comparator

Parameters
comparator Comparator: a Comparator for comparing the two values
Returns
BinaryOperator<T> a BinaryOperator which returns the lesser of its operands, according to the supplied Comparator
Throws
NullPointerException if the argument is null

Hooray!