takeWhileE method

Enumerable<T> takeWhileE (Condition<T> condition)

Takes all the elements at the beginning of the enumerable that match the condition and discards the rest.

During iteration, each element is given to the condition function. If the condition returns true, that element is returned. Once an element is processed where the condition returns false, iteration ends.

If all elements in the enumerable match the given condition, the resulting enumerable is unchanged.

Implementation

Enumerable<T> takeWhileE(Condition<T> condition) {
  assert(condition != null);

  return TakeWhileEnumerable<T>(this, condition);
}