Repository: commons-lang Updated Branches: refs/heads/master 96cb498f9 -> f4a262df5
[LANG-1290] StringUtils.join() with support for List<?> with configurable start/end indices. Extract constant. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/f4a262df Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/f4a262df Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/f4a262df Branch: refs/heads/master Commit: f4a262df5204221184f1f5008b06957868684a25 Parents: 96cb498 Author: Gary Gregory <garydgreg...@gmail.com> Authored: Tue May 22 08:57:50 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Tue May 22 08:57:50 2018 -0600 ---------------------------------------------------------------------- src/main/java/org/apache/commons/lang3/StringUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f4a262df/src/main/java/org/apache/commons/lang3/StringUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 82e4bee..550894e 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -115,6 +115,9 @@ import java.util.regex.Pattern; */ //@Immutable public class StringUtils { + + private static final int STRING_BUILDER_SIZE = 256; + // Performance testing notes (JDK 1.4, Jul03, scolebourne) // Whitespace: // Character.isWhitespace() is faster than WHITESPACE.indexOf() @@ -4618,7 +4621,7 @@ public class StringUtils { } // two or more elements - final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small + final StringBuilder buf = new StringBuilder(STRING_BUILDER_SIZE); // Java default is 16, probably too small if (first != null) { buf.append(first); } @@ -4662,7 +4665,7 @@ public class StringUtils { } // two or more elements - final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small + final StringBuilder buf = new StringBuilder(STRING_BUILDER_SIZE); // Java default is 16, probably too small if (first != null) { buf.append(first); }