Counts elements that satisfy the given predicate.
predicate
int countWhere(bool Function(T) predicate) { int count = 0; for (final T element in this) { if (predicate(element)) count++; } return count; }