The class ArithmeticUtils in the commons-numbers-core module contains
several methods where, since Java 8, equivalent methods in
java.lang.Math exist. These methods are the following:

addAndCheck(int, int)
addAndCheck(long, long)
mulAndCheck(int, int)
mulAndCheck(long, long)
subAndCheck(int, int)
subAndCheck(long, long)

The corresponding methods from java.lang.Math are:

addExact(int, int)
addExact(long, long)
multiplyExact(int, int)
multiplyExact(long, long)
subtractExact(int, int)
subtractExact(long, long)

The former methods are probably relics from pre-Java-8 times, when the
latter methods did not exist. But now, they are redundant. I suggest
they be removed from ArithmeticUtils in commons-numbers-core, and their
invocations replaced by invocations of the java.lang.Math equivalents.
Both groups of methods specify the same type of exception to be thrown
in case of an overflow (a java.lang.ArithmeticException), so the
replacement should be straightforward.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to