Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.6
-
None
-
None
-
None
Description
In the various join methods in StringUtils, the for-loop contains an if (i > startIndex) check (for an example see here, but it's present in all the join methods that take an array).
That is unnecessary - for the first iteration, we know the condition is false, while for the other iterations, we know the condition is true. So instead, we can do this:
- append the first element (at position startIndex)
- for every other element (starting at position startIndex + 1), append the separator, then the element.
It's basically the same tactic used in the Iterable version.
Attachments
Attachments
Issue Links
- links to