garydgregory commented on pull request #812:
URL: https://github.com/apache/commons-lang/pull/812#issuecomment-974667083
Thanks for the update @kinow
This pattern does not make sense to me:
```
return stringBuilder
.deleteCharAt(stringBuilder.length() - 1)
.toString();
```
First `deleteCharAt` is called which calls `System.arraycopy`, then
`toString()` is called which allocates the new String.
Why not skip the first part by simply saying:
```
return stringBuilder.substring(0, stringBuilder.length() - 1);
```
?
Also for the char and boolean versions, it seems like the builder size can
be simply computed because each element's String version is a fixed size
(assuming 5 for boolean). For ints and longs it might not be worth it as you'd
have to assume the max size.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]