RFR: 8264029: Replace uses of StringBuffer with StringBuilder in java.base

Aleksey Shipilev shade at openjdk.java.net
Wed Mar 24 18:14:49 UTC 2021


On Tue, 23 Mar 2021 21:54:33 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> I'm not sure how String.repeat can be used here. Repeated String is not constant and different for each iteration.
>
> Long runs of whitespace, especially in blank strings, may have poor readability. I was thinking that
> 
> " ".repeat(7) and " ".repeat(10)
>  
> 
> might read better than 
> 
> "       " and "          "
> 
> respectively. If you don't agree, then simply disregard what I said. If you agree but worry about negative performance implications, consider creating these strings before the respective for-loops.

I suggest we ignore the use case for `String.repeat` here, and leave the patch as is.

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

PR: https://git.openjdk.java.net/jdk/pull/2922


More information about the nio-dev mailing list