We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8cb790a commit d244231Copy full SHA for d244231
1 file changed
src/main/java/org/apache/commons/cli/CommandLine.java
@@ -240,13 +240,7 @@ public int getOptionCount(final char optionChar) {
240
* @since 1.11.0
241
*/
242
public int getOptionCount(final Option option) {
243
- int result = 0;
244
- for (Option opt : options) {
245
- if (Objects.equals(opt, option)) {
246
- ++result;
247
- }
248
249
- return result;
+ return (int) options.stream().filter(opt -> Objects.equals(opt, option)).count();
250
}
251
252
/**
0 commit comments