BinaryOperator
public interface BinaryOperator
implements BiFunction<T, T, T>
java.util.function.BinaryOperator<T> |
表示对两个相同类型操作数的操作,生成与操作数相同类型的结果。 对于操作数和结果都是相同类型的情况,这是BiFunction
的专门化。
这是一个 functional interface,其功能方法是 apply(Object, Object)
。
Summary
Public methods
maxBy
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 |
minBy
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 |