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

Add optional separator argument to StringBuffer.addAll() #9115

Closed
munificent opened this issue Mar 13, 2013 · 2 comments
Closed

Add optional separator argument to StringBuffer.addAll() #9115

munificent opened this issue Mar 13, 2013 · 2 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-core type-enhancement A request for a change that isn't a bug

Comments

@munificent
Copy link
Member

Consider:

writeFunctionCall(StringBuffer buffer, String name, Iterable args) {
  buffer.write(name);
  buffer.write("(");
  buffer.write(args.join(", ")); // <--
  buffer.write(")");
}

On the marked line, we're building up an intermediate string only to add it back to the StringBuffer. That's some wasted allocations.

Maybe a cleaner solution is to add an optional separator argument to StringBuffer.writeAll():

writeFunctionCall(StringBuffer buffer, String name, Iterable args) {
  buffer.write(name);
  buffer.write("(");
  buffer.writeAll(args, ", ");
  buffer.write(")");
}

@lrhn
Copy link
Member

lrhn commented Mar 13, 2013

Added Duplicate label.
Marked as being merged into #8694.

@munificent
Copy link
Member Author

Well, that will teach me to file bugs without searching first!

@munificent munificent added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core closed-duplicate Closed in favor of an existing report labels Mar 13, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-core type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants