Skip to content

Commit f3b23aa

Browse files
committed
Simplify code: Using JRE method instead of custom algorithm
1 parent 97faa56 commit f3b23aa

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/main/java/com/beust/jcommander/DefaultUsageFormatter.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,8 @@ public static String getI18nString(ResourceBundle bundle, String key, String def
404404
*
405405
* @return count-many spaces
406406
*/
407-
public static CharSequence s(int count) {
408-
StringBuilder result = new StringBuilder();
409-
410-
for (int i = 0; i < count; i++) {
411-
result.append(" ");
412-
}
413-
return result;
407+
public static String s(int count) {
408+
return " ".repeat(count);
414409
}
415410

416411
/**

src/main/java/com/beust/jcommander/JCommander.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -1566,13 +1566,8 @@ public String getParsedAlias() {
15661566
/**
15671567
* @return n spaces
15681568
*/
1569-
private CharSequence s(int count) {
1570-
StringBuilder result = new StringBuilder();
1571-
for (int i = 0; i < count; i++) {
1572-
result.append(" ");
1573-
}
1574-
1575-
return result;
1569+
private String s(int count) {
1570+
return " ".repeat(count);
15761571
}
15771572

15781573
/**

0 commit comments

Comments
 (0)