Skip to content

some misc code simplifications in Records#1380

Merged
otaviojava merged 1 commit intojakartaee:mainfrom
gavinking:misc-code-cleanups
Feb 20, 2026
Merged

some misc code simplifications in Records#1380
otaviojava merged 1 commit intojakartaee:mainfrom
gavinking:misc-code-cleanups

Conversation

@gavinking
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Member

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look correct, but a general comment is that although the use of String addition does make the code more concise, repeated String concatenation is also less efficient than StringBuilder.

@gavinking
Copy link
Copy Markdown
Member Author

repeated String concatenation is also less efficient than StringBuilder.

I don't think that's been true for a long time. String concatenation used to desugar to StringBuilder.append(), but in modern versions of Java (9 and above) it compiles to something even more efficient.

(It still makes sense to use StringBuilder in a loop or when you have conditional logic, however.)

@otaviojava otaviojava merged commit a8577fa into jakartaee:main Feb 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants