Interface BinaryOperator<T>

Type Parameters:
T - the operand and result type
All Superinterfaces:
BiFunction<T,T,T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BinaryOperator<T> extends BiFunction<T,T,T>
An operation on two values of one type that answers that type.
  • Method Details

    • minBy

      static <T> BinaryOperator<T> minBy(Comparator<? super T> comparator)
      The smaller of two values by comparator; the first on a tie.
      Type Parameters:
      T - the type
      Parameters:
      comparator - the order
      Returns:
      the operator
    • maxBy

      static <T> BinaryOperator<T> maxBy(Comparator<? super T> comparator)
      The larger of two values by comparator; the first on a tie.
      Type Parameters:
      T - the type
      Parameters:
      comparator - the order
      Returns:
      the operator