There was an error while loading. Please reload this page.
1 parent c9ffd67 commit 4dec263Copy full SHA for 4dec263
1 file changed
src/main/java/org/apache/commons/cli/Options.java
@@ -25,6 +25,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
25
import java.util.LinkedHashMap;
26
import java.util.List;
27
import java.util.Map;
28
+import java.util.stream.Collectors;
29
30
/**
31
* Main entry-point into the library.
@@ -227,12 +228,7 @@ public List<String> getMatchingOptions(final String opt) {
227
228
if (longOpts.containsKey(clean)) {
229
return Collections.singletonList(clean);
230
}
- longOpts.keySet().forEach(longOpt -> {
231
- if (longOpt.startsWith(clean)) {
232
- matchingOpts.add(longOpt);
233
- }
234
- });
235
- return matchingOpts;
+ return longOpts.keySet().stream().filter(s -> s.startsWith(clean)).collect(Collectors.toList());
236
237
238
0 commit comments