takeE method

Enumerable<T> takeE (int count)

Takes the first count elements in the enumerable and discards the rest.

During iteration, the first count number of elements are returned as normal. Once that number of elements has elapsed, iteration will end.

If count is greater than the number of elements in the enumerable, the resulting enumerable is unchanged.

Implementation

Enumerable<T> takeE(int count) {
  RangeError.checkNotNegative(count);
  if (count == 0) return Enumerable<T>.empty();
  return TakeEnumerable<T>(this, count);
}