This inspection suggests to use Integer.compare()
, etc. static methods where more verbose or less efficient constructs are
used. For example, x > y ? 1 : x < y ? -1 : 0
or Integer.valueOf(x).compareTo(y)
could be
replaced with Integer.compare(x, y)
. If x
and y
are already boxed integers, then
x.compareTo(y)
is suggested.
Double.compare
and Float.compare
methods appeared in Java 1.4, methods for other primitive types
are available since Java 1.7
New in 2017.2