withoutFirst method

Iterable<T> withoutFirst()

Lazily returns all values without the first one.

Example:

[1, 2, 3].withoutFirst(); // [2, 3]
[].withoutFirst(); // [];

Implementation

Iterable<T> withoutFirst() sync* {
  final iter = iterator;

  iter.moveNext(); // eat the first

  while (iter.moveNext()) {
    yield iter.current;
  }
}