Skip to content

Commit

Permalink
Deprecating Strings.join(String, String...)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Dec 23, 2024
1 parent 767d13a commit fb4af53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/beust/jcommander/JCommander.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public void parseWithoutValidation(String... args) {

private void parse(boolean validate, String... args) {
StringBuilder sb = new StringBuilder("Parsing \"");
sb.append(Strings.join(" ", args)).append("\"\n with:").append(Strings.join(" ", objects.toArray()));
sb.append(String.join(" ", args)).append("\"\n with:").append(Strings.join(" ", objects.toArray()));
p(sb.toString());

if (descriptions == null) createDescriptions();
Expand Down Expand Up @@ -394,9 +394,9 @@ private void validateOptions() {
if (!requiredFields.isEmpty()) {
List<String> missingFields = new ArrayList<>();
requiredFields.values().forEach(pd ->
missingFields.add("[" + Strings.join(" | ", pd.getParameter().names()) + "]")
missingFields.add("[" + String.join(" | ", pd.getParameter().names()) + "]")
);
String message = Strings.join(", ", missingFields);
String message = String.join(", ", missingFields);
throw new ParameterException("The following "
+ pluralize(requiredFields.size(), "option is required: ", "options are required: ")
+ message);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/beust/jcommander/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static boolean startsWith(String s, String with, boolean isCaseSensitive)
return isCaseSensitive ? s.startsWith(with) : s.toLowerCase().startsWith(with.toLowerCase());
}

@Deprecated(forRemoval = true, since = "3.0.0")
public static String join(String delimiter, List<String> args) {
return String.join(delimiter, args);
}
Expand Down

0 comments on commit fb4af53

Please sign in to comment.