countWhere method
Returns the number of elements that satisfy the given predicate.
Implementation
@useResult
int countWhere(ElementPredicate<T> predicate) {
int count = 0;
for (final T element in this) {
if (predicate(element)) count++;
}
return count;
}