setAll method

IList<T> setAll(
  1. int index,
  2. Iterable<T> iterable
)

Overwrites objects of this with the objects of iterable, starting at position index in this list.

final IList<String> ilist = ['a', 'b', 'c'].lock;
ilist.setAll(1, ['bee', 'sea']).join(', '); // 'a, bee, sea'

This operation does not increase the length of this.

The index must be non-negative and no greater than length.

The iterable must not have more elements than what can fit from index to length.

If iterable is based on this list, its values may change during the setAll operation.

Implementation

IList<T> setAll(int index, Iterable<T> iterable) {
  // TODO: Still need to implement efficiently.
  var list = toList(growable: true);
  list.setAll(index, iterable);
  return IList._unsafeFromList(list, config: config);
}