Re: RFR: 8277868: Use Comparable.compare() instead of surrogate code

2021-11-27 Thread Michael Bien
On Fri, 26 Nov 2021 12:46:59 GMT, Сергей Цыпанов 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/Basic

Re: String.indexOf(single-char-String)

2021-11-27 Thread Michael Bien
StringIndexOfChar showed that the assumption that the char variant should be at least as fast as the String variant doesn't always apply. The implementation for indexOf(char) seems to have a different code emission heuristics than the String variant. https://github.com/openjdk/jdk/pull/6509#iss

Re: RFR: 8274811: Remove superfluous use of boxing in java.base

2021-11-27 Thread Andrey Turbanov
On Sat, 11 Sep 2021 12:11:50 GMT, Andrey Turbanov wrote: > Usages of primitive types should be preferred and makes code easier to read. > Similar cleanups: > 1. [JDK-8273168](https://bugs.openjdk.java.net/browse/JDK-8273168) > java.desktop > 2. [JDK-8274234](https://bugs.openjdk.java.net/browse/