Skip to content

Commit d244231

Browse files
committed
Use Stream.count()
1 parent 8cb790a commit d244231

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

src/main/java/org/apache/commons/cli/CommandLine.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,7 @@ public int getOptionCount(final char optionChar) {
240240
* @since 1.11.0
241241
*/
242242
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;
243+
return (int) options.stream().filter(opt -> Objects.equals(opt, option)).count();
250244
}
251245

252246
/**

0 commit comments

Comments
 (0)