swapWithSlice method
Swaps all elements in this with those in other. The length of other must be the same as this. Will throw if the length of other is not the same as this.
Implementation
void swapWithSlice(Slice<T> other) {
assert(_end - _start == other._end - other._start,
"Slices must be the same length");
for (var i = 0; i < _end - _start; i++) {
var temp = _list[i + _start];
_list[i + _start] = other._list[i + other._start];
other._list[i + other._start] = temp;
}
}