count method
Return the number of elements in this collection that satisfy the given predicate.
Implementation
int count(Function1<A, bool> p) {
var res = 0;
final it = iterator;
while (it.hasNext) {
if (p(it.next())) res += 1;
}
return res;
}