void (final Comparator<? super F> comp) { // this size() forces a full scan/update of the list. if (comp == null) { // sort by the 'natural order', which, there is none. // options, throw exception, or let the current-order represent the natural order. // do nothing is the better alternative. return; } final int sz = size(); final int[] indexes = new int[sz]; for (int i = 0; i < sz; i++) { final int ip = fbinarySearch(indexes, i, i, comp); if (ip < i) { System.arraycopy(indexes, ip, indexes, ip + 1, i - ip); } indexes[ip] = backingpos[i]; } sortInPlace(indexes); }