rotateLeft method
Rotates the slice in-place such that the first mid elements of the slice move to the end while the
last this.len() - mid
elements move to the front. After calling rotateLeft, the element previously
at index mid will become the first element in the slice.
Implementation
void rotateLeft(int mid) {
int length = len();
if (mid > length) {
throw ArgumentError("mid is greater than the length of the list.");
}
if (mid == length || mid == 0) {
return;
}
_reverse(this, 0, mid - 1);
_reverse(this, mid, length - 1);
_reverse(this, 0, length - 1);
}