swap method

void swap(
  1. int indexA,
  2. int indexB
)

Swaps position of items at given indexes

Implementation

void swap(int indexA, int indexB) {
  T a = _list[indexA];
  T b = _list[indexB];

  _list.removeAt(indexA);
  _list.insert(indexA, b);

  _list.removeAt(indexB);
  _list.insert(indexB, a);

  notify();
}