Skip to content

StringBuilder can be replaced with String concatenation. #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

DiegoKrupitza
Copy link
Contributor

In this case the usage of StringBuilder has no additional benefit, since it is not inside a loop where the jvm may have problems detecting String concatenation that can be optimized. The usage of "simple" String concatenation makes the code more readable and the code will be automatically optimized by the compiler. (So the final result may use StringBuilder).

For me see here:
https://stackoverflow.com/questions/1532461/stringbuilder-vs-string-concatenation-in-tostring-in-java

In this case the usage of `StringBuilder` has no additional benefit, since it is not inside a loop where the jvm may have problems detecting String concatenation that can be optimized. The usage of "simple" String concatenation makes the code more readable and the code will be automatically optimized by the compiler. (So the final result may use `StringBuilder`).
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 17, 2022
schauder pushed a commit that referenced this pull request Feb 21, 2022
In this case the usage of `StringBuilder` has no additional benefit, since it is not inside a loop where the JVM may have problems detecting String concatenation that can be optimized. The usage of "simple" String concatenation makes the code more readable and the code will be automatically optimised by the compiler.

Original pull request #1173
schauder pushed a commit that referenced this pull request Feb 21, 2022
In this case the usage of `StringBuilder` has no additional benefit, since it is not inside a loop where the JVM may have problems detecting String concatenation that can be optimized. The usage of "simple" String concatenation makes the code more readable and the code will be automatically optimised by the compiler.

Original pull request #1173
@schauder
Copy link
Contributor

Thanks. That's merged.

@schauder schauder closed this Feb 21, 2022
@schauder schauder added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants