swap method

void swap(
  1. int index1,
  2. int index2
)

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;
}