Is there a multiplication analogue to Integer::sum?

higher-order-functions, java, java-8, lambda, method-reference

Solution

`Math::multiplyExact`

`static int multiplyExact(int x, int y)`

Returns the product of the arguments, throwing an exception if the result overflows an int.

Problem

Since Java 8, the `Integer` class has a static `sum` method that adds two integers: ``` public static int sum(int a, int b) { return a + b; } ``` I can pass this method to higher-order functions via `Integer::sum` which I find more readable than `(a, b) -> a + b`. Is there a similar static method for multiplication, so I don't have to write `(a, b) -> a * b`? I couldn't find one in the `Integer` class.

Original source