RFR 8214971 : Replace use of string.equals("") with isEmpty()
Pavel Rappo
pavel.rappo at oracle.com
Thu Dec 6 21:08:45 UTC 2018
Roger, changes look good. On a side note, it's impressive how many cases we have
when we check for string not being null and empty. We should have had something
for that *internally* in the JDK. And it's a pity that `String.trim().isEmpty()`
not equivalent to `String.isBlank`. Seems to be a frequent case too.
> On 6 Dec 2018, at 20:04, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>
> Please review changing string.equals("") to string.isEmpty().
> isEmpty is preferred, performs better and is easier to optimize.
>
> The change is a literal substitution in all files and only in these modules:
>
> java.base
> java.logging
> java.management
> java.management.rmi
> java.naming
> java.net.http
> java.prefs
> java.rmi
> java.scripting
> java.sql
> java.sql.rowset
> java.xml
> jdk.jartool
> jdk.javadoc
> jdk.jcmd
> jdk.jconsole
> jdk.management.agent
> jdk.naming.dns
> jdk.rmic
>
>
> Webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-string-isempty-8214971-1/
>
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8214971
>
> Thanks, Roger
More information about the core-libs-dev
mailing list