Skip to content

Commit

Permalink
Using String.join() instead of custom code
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Dec 2, 2024
1 parent f3b23aa commit 7b8b4e6
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/main/java/com/beust/jcommander/ParameterDescription.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,7 @@ public Object getObject() {
}

public String getNames() {
StringBuilder sb = new StringBuilder();
String[] names = wrappedParameter.names();
for (int i = 0; i < names.length; i++) {
if (i > 0) sb.append(", ");
sb.append(names[i]);
}
return sb.toString();
return String.join(", ", wrappedParameter.names());
}

public String getCategory() {
Expand Down

0 comments on commit 7b8b4e6

Please sign in to comment.