RFR 8214971 : Replace use of string.equals("") with isEmpty()

Pavel Rappo pavel.rappo at oracle.com
Thu Dec 6 20:40:03 UTC 2018


> On 6 Dec 2018, at 20:27, Jim Laskey <james.laskey at oracle.com> wrote:
> 
> I assume you automated this change, might be worthwhile to automate a verification (compare the -+ pairs.) Eyeballing the patch it seems complete, one comment changed as well.
> 
> Question: Is it probably that vm optimizes .equals(“”) to .isEmpty() and there is no net win, ie., more of an esthetic clean up than for performance?
> 

String.isEmpty might read better (subject to preference). Builds and tests on
all systems should be performed. With an automatic (batch) change like this,
there's always a possibility of trying to call isEmpty on a non-String
reference.

-Pavel



More information about the core-libs-dev mailing list