<i18n dev> RFR: 8277868: Use Comparable.compare() instead of surrogate code

Michael Bien duke at openjdk.java.net
Sat Nov 27 22:54:16 UTC 2021


On Fri, 26 Nov 2021 12:46:59 GMT, Сергей Цыпанов <duke at openjdk.java.net> wrote:

> Instead of something like
> 
> long x;
> long y;
> return (x < y) ? -1 : ((x == y) ? 0 : 1);
> 
> we can use `return Long.compare(x, y);`
> 
> All replacements are done with IDE.

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java line 249:

> 247: 
> 248:         private static int sign(int num) {
> 249:             return Integer.compare(num, 0);

=> Integer.signum(num)

-------------

PR: https://git.openjdk.java.net/jdk/pull/6575


More information about the i18n-dev mailing list