count method

int count(
  1. bool test(
    1. E element
    )
)

Returns the number of elements matching the given test.

Implementation

int count(bool Function(E element) test) {
  var count = 0;

  for (final current in this) {
    if (!test(current)) continue;
    count++;
  }

  return count;
}