Skip to content

Commit

Permalink
Simplify code: Using JRE method instead of custom algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Dec 1, 2024
1 parent 97faa56 commit f3b23aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/main/java/com/beust/jcommander/DefaultUsageFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,8 @@ public static String getI18nString(ResourceBundle bundle, String key, String def
*
* @return count-many spaces
*/
public static CharSequence s(int count) {
StringBuilder result = new StringBuilder();

for (int i = 0; i < count; i++) {
result.append(" ");
}
return result;
public static String s(int count) {
return " ".repeat(count);
}

/**
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/com/beust/jcommander/JCommander.java
Original file line number Diff line number Diff line change
Expand Up @@ -1566,13 +1566,8 @@ public String getParsedAlias() {
/**
* @return n spaces
*/
private CharSequence s(int count) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < count; i++) {
result.append(" ");
}

return result;
private String s(int count) {
return " ".repeat(count);
}

/**
Expand Down

0 comments on commit f3b23aa

Please sign in to comment.