static count(array, check) {
    let count = 0;

    for (const element of array) {
      count += check(element) ? 1 : 0;
    }

    return count;
  }
Count the number of items in the list that pass the check function.
@param {!Array<T>} array
@param {function(T):boolean} check
@return {number}
@template T