Type a two-param lambda assigned to a BinaryOperator
Type a two-param lambda assigned to a BinaryOperator
Answer
BinaryOperator<Integer> add = (a, b) -> a + b;
BinaryOperator<T> is a functional interface whose single abstract method is apply(T, T) -> T. The compiler wires (a, b) -> a + b to that method automatically.