RFR: 8215281: Use String.isEmpty() where applicable in java.base

Claes Redestad claes.redestad at oracle.com
Wed Dec 12 16:53:11 UTC 2018


Hi,

please review this patch to use String.isEmpty when applicable:

Webrev: http://cr.openjdk.java.net/~redestad/8215281/jdk.00/
Bug: https://bugs.openjdk.java.net/browse/JDK-8215281

Why?
- It reads better :-)
- Better startup/warmup due fewer method invocations
- Better peak performance: String.isEmpty is ~1.2x faster than
   String.length

Most changes are simple search and replace, but I took the liberty to
clean out some dead/pointless uses and improve formatting in places due
the shorter expression length.

Instances of "".equals(string) were only changed when it was immediately
obvious that string is not null, e.g., due a preceding null check.

Thanks!

/Claes



More information about the security-dev mailing list