isSorted method

bool isSorted()

Checks if the elements of this slice are sorted. That is, for each element a and its following element b, a <= b must hold.

Implementation

bool isSorted() {
  for (int i = _start; i < _end - 1; i++) {
    if (_list[i].compareTo(_list[i + 1]) > 0) {
      return false;
    }
  }
  return true;
}