Skip to content
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

Eliminate the Use of StringBuffer #2909

Conversation

NathanQingyangXu
Copy link
Contributor

There are two usages of StringBuffer. This PR aims to either replace it with more appropriate and efficient StringBuilder or simply eliminate its usage if better alternative exists.

records.spliterator().forEachRemaining(rec -> sb
.append(KafkaUtils.format(rec))
.append(','));
sb.deleteCharAt(sb.length() - 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the above implementation also throws exception when records is an empty one

@garyrussell garyrussell merged commit d01cc8e into spring-projects:main Nov 20, 2023
1 check passed
@garyrussell garyrussell added this to the 3.1.0 milestone Nov 20, 2023
@garyrussell garyrussell changed the title eliminate the usage of StringBuffer Eliminate the Use of StringBuffer Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants