@Override
  public List<T> sort(List<T> list) {
    int innerIndex;
    // The first element starts sorted (it may move later).
    // Iterate one by one up the list.
    for (int sortedIndex = 1; sortedIndex < list.size(); sortedIndex++) {
      innerIndex = sortedIndex;
      // At each phase as we move up the list, take the next unsorted element (one to the right
      // of the sorted list boundary) and with that unsorted element, move down the list,
      // swapping the element as it goes until that element is in the proper sorted position.
      while (innerIndex > 0 && list.get(innerIndex - 1).compareTo(list.get(innerIndex)) > 0) {
        listSorterHelper.swap(list, innerIndex, innerIndex - 1);
        innerIndex--;
      }
    }
    return list;
  }