countWhere method

  1. @useResult
int countWhere(
  1. ElementPredicate<T> predicate
)

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;
}