On Fri, 19 Jul 2024 21:34:36 GMT, Shaojin Wen <d...@openjdk.org> wrote:

>> Currently simpleConcat is implemented using mix and prepend, but in this 
>> simple scenario, it can be implemented in a simpler way and can improve 
>> performance.
>
> Shaojin Wen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   handle null argument

src/java.base/share/classes/java/lang/String.java line 2990:

> 2988:             return this;
> 2989:         }
> 2990:         return StringConcatHelper.doConcat(this, str == null ? "null" : 
> str);

Suggestion:

        if (isEmpty()) {
            return str;
        }
        return StringConcatHelper.doConcat(this, str);

`str.isEmpty()` already does the null check.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20253#discussion_r1685008791

Reply via email to