cycle method

Iterable<T> cycle()

Lazy infinite iterable repeating this list.

Implementation

Iterable<T> cycle() sync* {
  if (isEmpty) return;
  int i = 0;
  while (true) {
    yield this[i % length];
    i++;
  }
}