reverse method

void reverse()

Reverses elements in the list in-place.

Implementation

void reverse() {
  final mid = size >> 1;

  var i = 0;
  var j = size - 1;
  while (i < mid) {
    swap(i, j);
    i++;
    j--;
  }
}