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 49359f1 commit 4477e81
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 4477e81

Please sign in to comment.