swap method
Swaps two elements of this list.
Implementation
void swap(int index1, int index2) {
RangeError.checkValidIndex(index1, this, 'index1');
RangeError.checkValidIndex(index2, this, 'index2');
var tmp = this[index1];
this[index1] = this[index2];
this[index2] = tmp;
}