RFR: 8274163: Use String.equals instead of String.compareTo in jdk.jcmd

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Wed Sep 22 19:21:08 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 in jdk.jcmd

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

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


More information about the serviceability-dev mailing list