Hi Serw,
On 13.12.2024 22:08, Serw wrote:
Would the community support using string concatenation over StringBuilder
for simple cases? Modern JDKs (8+) optimize string concatenation
efficiently, making it both concise and performant.
Since the Javac compiler replaces string concatenation with
StringBuilder, I wouldn't expect any performance improvement (at least
until we keep the JRE 8 compatibility).
Personally I find concatenated strings more concise and easy to read, so
I would be +1 for this change. There is even an OpenRewrite recipe[1]
that can apply it automatically.
Piotr
[1]
https://docs.openrewrite.org/recipes/staticanalysis/replacestringbuilderwithstring