swap method

void swap(
  1. int first,
  2. int second
)

Implementation

void swap(int first, int second) {
  if ((this).isNotEmpty) {
    final temp = this[first];
    this[first] = this[second];
    this[second] = temp;
  }
}