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 08:12:29 UTC 2021


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.

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

Commit messages:
 - [PATCH] Use String.equals instead of String.compareTo to check String's equality

Changes: https://git.openjdk.java.net/jdk/pull/5638/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5638&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8274190
  Stats: 20 lines in 7 files changed: 0 ins; 3 del; 17 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5638.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5638/head:pull/5638

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


More information about the serviceability-dev mailing list