getManyUnchecked method

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

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

Implementation

Arr<T> getManyUnchecked(Arr<int> indices) {
  if (indices.isEmpty()) {
    return Arr.constant(const []);
  }
  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 >= 0 && index < length,
        "The requested index `$index` out of bounds. Length was `$length`");
    array[i] = getUnchecked(index);
  }
  return array;
}