countList<T> function

int countList<T>(
  1. Iterable<T> it,
  2. T element
)

Count number of occurrences in an iterable.

Implementation

int countList<T>(Iterable<T> it, T element) {
  int count = 0;
  for (var v in it) {
    if (deepEquals(v, element)) {
      count++;
    }
  }
  return count;
}