Count method
Returns the number of elements in the enumerable.
Iterates over the entire enumerable and returns the number of elements that were iterated over.
The Count function will iterate over every element in the enumerable.
Implementation
int Count() {
final iterator = this.iterator;
int count = 0;
while (iterator.moveNext()) {
count++;
}
return count;
}