Question about String.toUpperCase behaviour

Hans Boehm hboehm at google.com
Tue Oct 29 20:35:32 UTC 2019


On Tue, Oct 29, 2019 at 1:12 PM Rob Spoor <openjdk at icemanx.nl> wrote:
>
> I agree. There is no reason to use == instead of equals. Not for
> readability, because it will most likely confuse people who will come
> asking why you're not using equals. Not for performance, because since
> at least Java 7 String.equals starts with this:
>
>          if (this == anObject) {
>              return true;
>          }
>
That doesn't remove the performance difference when the string is NOT upper
case.


More information about the core-libs-dev mailing list