code: public static <T extends Comparable<? super T>> void sort (List<T> a)
      {
          sort(a, new Comparator<T>() {
              public int compare (T o1, T o2) {
                  if (o1 == o2) { // catches null == null
                      return 0;
                  } else if (o1 == null) {
                      return 1;
                  } else if (o2 == null) {
                      return -1;
                  }
                  return o1.compareTo(o2); // null-free
              }
          });
      }
docs: Sort the elements in the specified List according to their natural order.