getManyUnchecked method

Arr<T> getManyUnchecked(
  1. List<int> indices
)

Returns mutable references to many indices at once, without doing any checks.

Implementation

Arr<T> getManyUnchecked(List<int> indices) {
  assert(indices.length <= _end - _start,
      "The number of indices must be less than or equal to the length of the slice");
  if (indices.isEmpty) {
    return Arr.empty();
  }
  assert(isNotEmpty, "Requested indices, but this slice is empty.");
  var array = Arr(this.first, indices.length);
  for (final (int i, int index) in indices.iter().enumerate()) {
    assert(index >= _start && index < _end,
        "The requiested index out of bounds");
    array[i] = this[index];
  }
  return array;
}