shift method
Shifts the order of the elements by the provided amount
.
Implementation
void shift(int amount) {
amount %= length;
if (amount > 0) {
insertAll(0, pluck(length - amount));
} else if (amount < 0) {
addAll(pluck(0, amount.abs()));
}
}