Skip to content

Commit 9830ec0

Browse files
committed
Use the same name method name as Commons Lang
1 parent 6f73301 commit 9830ec0

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/main/java/org/apache/commons/cli/help/TextHelpAppendable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public void appendHeader(final int level, final CharSequence text) throws IOExce
208208
final int idx = Math.min(level, fillChars.length) - 1;
209209
final TextStyle style = styleBuilder.get();
210210
final Queue<String> queue = makeColumnQueue(text, style);
211-
queue.add(Util.createPadding(style.getLeftPad()) + Util.filledString(Math.min(text.length(), style.getMaxWidth()), fillChars[idx]));
211+
queue.add(Util.createPadding(style.getLeftPad()) + Util.repeat(Math.min(text.length(), style.getMaxWidth()), fillChars[idx]));
212212
queue.add(BLANK_LINE);
213213
printQueue(queue);
214214
}
@@ -261,7 +261,7 @@ public void appendTitle(final CharSequence title) throws IOException {
261261
if (!Util.isEmpty(title)) {
262262
final TextStyle style = styleBuilder.get();
263263
final Queue<String> queue = makeColumnQueue(title, style);
264-
queue.add(Util.createPadding(style.getLeftPad()) + Util.filledString(Math.min(title.length(), style.getMaxWidth()), '#'));
264+
queue.add(Util.createPadding(style.getLeftPad()) + Util.repeat(Math.min(title.length(), style.getMaxWidth()), '#'));
265265
queue.add(BLANK_LINE);
266266
printQueue(queue);
267267
}

src/main/java/org/apache/commons/cli/help/Util.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class Util {
3333
* @since 1.10.0
3434
*/
3535
static String createPadding(final int len) {
36-
return filledString(len, ' ');
36+
return repeat(len, ' ');
3737
}
3838

3939
/**
@@ -48,19 +48,6 @@ static <T extends CharSequence> T defaultValue(final T str, final T defaultValue
4848
return isEmpty(str) ? defaultValue : str;
4949
}
5050

51-
/**
52-
* Constructs a string of specified length filled with the specified char.
53-
*
54-
* @param len the length of the final string.
55-
* @param fillChar the character to file it will.
56-
* @return A string of specified length filled with the specified char.
57-
*/
58-
static String filledString(final int len, final char fillChar) {
59-
final char[] padding = new char[len];
60-
Arrays.fill(padding, fillChar);
61-
return new String(padding);
62-
}
63-
6451
/**
6552
* Finds the position of the first non whitespace character.
6653
*
@@ -110,6 +97,19 @@ static String ltrim(final String s) {
11097
return pos == -1 ? "" : s.substring(pos);
11198
}
11299

100+
/**
101+
* Constructs a string of specified length filled with the specified char.
102+
*
103+
* @param len the length of the final string.
104+
* @param fillChar the character to file it will.
105+
* @return A string of specified length filled with the specified char.
106+
*/
107+
static String repeat(final int len, final char fillChar) {
108+
final char[] padding = new char[len];
109+
Arrays.fill(padding, fillChar);
110+
return new String(padding);
111+
}
112+
113113
/**
114114
* Removes the trailing whitespace from the specified String.
115115
*

0 commit comments

Comments
 (0)