Skip to content

Commit

Permalink
Simplified Strings::join(String, List<String>)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Aug 9, 2024
1 parent 1df8421 commit e5c4772
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/main/java/com/beust/jcommander/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ public static boolean startsWith(String s, String with, boolean isCaseSensitive)
}

public static String join(String delimiter, List<String> args) {
StringBuilder builder = new StringBuilder();

for (int i = 0; i < args.size(); i++) {
builder.append(args.get(i));

if (i + 1 < args.size())
builder.append(delimiter);
}
return builder.toString();
return String.join(delimiter, args);
}

public static String join(String delimiter, Object[] args) {
Expand Down

0 comments on commit e5c4772

Please sign in to comment.