You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe it is somewhat common to filter a stream and count the number of elements, for example to count the number of even numbers in a range u would write: long evenCount = IntStreamEx.range(n).filter(x -> x % 2 == 0).count();
However a count method that takes in a Predicate and only counts the element if it matches the predicate would be more convenient imo.
Example: long evenCount = IntStreamEx.range(n).count(x -> x % 2 == 0);
Alternatively the method could be called countIf
The text was updated successfully, but these errors were encountered:
I believe it is somewhat common to filter a stream and count the number of elements, for example to count the number of even numbers in a range u would write:
long evenCount = IntStreamEx.range(n).filter(x -> x % 2 == 0).count();
However a count method that takes in a Predicate and only counts the element if it matches the predicate would be more convenient imo.
Example:
long evenCount = IntStreamEx.range(n).count(x -> x % 2 == 0);
Alternatively the method could be called
countIf
The text was updated successfully, but these errors were encountered: