RFR: 8274190: Use String.equals instead of String.compareTo in jdk.internal.jvmstat

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Thu Sep 23 20:08:00 UTC 2021


On Thu, 23 Sep 2021 19:34:35 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> In several places, String.compareTo was _compared_ with 0 ( via `== 0` or `!= 0`).
>> Instead of this, we can use String.equals calls. `String.equals` is faster and shorter.
>
> src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java line 346:
> 
>> 344:         String authority = vmid.getAuthority();
>> 345: 
>> 346:         if ("file".equals(scheme)) {
> 
> Nit: Not your issue but you can also get rid of unneeded brackets ().

I'm not sure. Brackets in which statement do mean here?

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

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


More information about the serviceability-dev mailing list