Skip to content

Commit 8e325f0

Browse files
committed
refine javadoc about StringUtils.repeat(StringBuilder stringBuilder, final char ch, final int repeat), and make it private
1 parent e75a0fb commit 8e325f0

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

src/main/java/org/apache/commons/lang3/StringUtils.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6240,28 +6240,17 @@ public static String repeat(final char ch, final int repeat) {
62406240
}
62416241

62426242
/**
6243-
* <p>Returns padding using the specified delimiter repeated
6244-
* to a given length.</p>
6243+
* <p>Make the padding using the specified delimiter repeated
6244+
* to a given length, and fill the result to a StringBuilder</p>
62456245
*
6246-
* <pre>
6247-
* StringUtils.repeat('e', 0) = ""
6248-
* StringUtils.repeat('e', 3) = "eee"
6249-
* StringUtils.repeat('e', -2) = ""
6250-
* </pre>
6251-
*
6252-
* <p>Note: this method does not support padding with
6253-
* <a href="http://www.unicode.org/glossary/#supplementary_character">Unicode Supplementary Characters</a>
6254-
* as they require a pair of {@code char}s to be represented.
6255-
* If you are needing to support full I18N of your applications
6256-
* consider using {@link #repeat(String, int)} instead.
6257-
* </p>
6246+
* This function works like {@code stringBuilder.append(repeat(ch,repeat))}, but runs faster.
62586247
*
62596248
* @param stringBuilder stringBuilder to fill
62606249
* @param ch character to repeat
62616250
* @param repeat number of times to repeat char, negative treated as zero
6262-
* @see #repeat(String, int)
6251+
* @see #repeat(char, int)
62636252
*/
6264-
public static void repeat(StringBuilder stringBuilder, final char ch, final int repeat) {
6253+
private static void repeat(StringBuilder stringBuilder, final char ch, final int repeat) {
62656254
for (int i = repeat - 1; i >= 0; i--) {
62666255
stringBuilder.append(ch);
62676256
}

0 commit comments

Comments
 (0)