Sorts the tests in <code>target</code> using <code>comparator</code>.

@since 4.0
549420
@Override
    public void apply(Object target) {
        /*
         * Note that all runners that are Orderable are also Sortable (because
         * Orderable extends Sortable). Sorting is more efficient than ordering,
         * so we override the parent behavior so we sort instead.
         */
        if (target instanceof Sortable) {
            Sortable sortable = (Sortable) target;
            sortable.sort(this);
        }
    }
1200670
public static <T> void sort (List<T> a, int lo0, int hi0, Comparator<? super T> comp)
    {
        // bail out if we're already done
        if (hi0 <= lo0) {
            return;
        }

        T e1, e2;

        // if this is a two element file, do a simple sort on it
        if (hi0 - lo0 == 1) {
            // if they're not already sorted, swap them
            e1 = a.get(lo0);
            e2 = a.get(hi0);
            if (comp.compare(e2, e1) < 0) {
                a.set(hi0, e1);
                a.set(lo0, e2);
            }
            return;
        }

        // the middle element in the array is our partitioning element
        T mid = a.get((lo0 + hi0) >>> 1);

        // set up our partitioning boundaries
        int lo = lo0-1, hi = hi0+1;

        // loop through the array until indices cross
        for (;;) {
            // find the first element that is greater than or equal to the partition element
            // starting from the left index
            do {
                e1 = a.get(++lo);
            } while (comp.compare(e1, mid) < 0);

            // find an element that is smaller than or equal to the partition element starting from
            // the right index
            do {
                e2 = a.get(--hi);
            } while (comp.compare(mid, e2) < 0);

            // swap the two elements or bail out of the loop
            if (hi > lo) {
                a.set(lo, e2);
                a.set(hi, e1);
            } else {
                break;
            }
        }

        // if the right index has not reached the left side of array must now sort the left
        // partition
        if (lo0 < lo-1) {
            sort(a, lo0, lo-1, comp);
        }

        // if the left index has not reached the right side of array must now sort the right
        // partition
        if (hi+1 < hi0) {
            sort(a, hi+1, hi0, comp);
        }
    }
658546
public static <T, L extends List<T>> L sortThis(L list, Comparator<? super T> comparator)
    {
        if (list instanceof MutableList)
        {
            ((MutableList<T>) list).sortThis(comparator);
        }
        else if (list instanceof ArrayList)
        {
            ArrayListIterate.sortThis((ArrayList<T>) list, comparator);
        }
        else
        {
            if (list.size() > 1)
            {
                Collections.sort(list, comparator);
            }
        }
        return list;
    }
353317
public void apply(Object target) throws InvalidOrderingException {
        /*
         * Note that some subclasses of Ordering override apply(). The Sorter
         * subclass of Ordering overrides apply() to apply the sort (this is
         * done because sorting is more efficient than ordering).
         */
        if (target instanceof Orderable) {
            Orderable orderable = (Orderable) target;
            orderable.order(new Orderer(this));
        }
    }
325488
public <T extends Comparable<T>> void sortR(List<T> list)
    {
        sort(list, getReverse(defaultComp));
    }
967744
public static <T> ArrayList<T> sortThis(ArrayList<T> list, Comparator<? super T> comparator)
    {
        int size = list.size();
        if (ArrayListIterate.canAccessInternalArray(list))
        {
            Arrays.sort(ArrayListIterate.getInternalArray(list), 0, size, comparator);
        }
        else
        {
            Collections.sort(list, comparator);
        }
        return list;
    }
276365
private void sort() {
        RangeHashSorter sortMachine;
        sortMachine = new RangeHashSorter(maxRangeValues, filenames);
        sortMachine.quickSort();
        generateBucketIds();
    }
764325
protected List<ExecutableElement> getOrderedMethods(TypeElement typeElement, Comparator<ExecutableElement> comparator) {
		List<ExecutableElement> methods = ElementFilter.methodsIn(typeElement.getEnclosedElements());
		Collections.sort(methods, comparator);
		return methods;
	}
1175311
public void removeTarget(T target) {
    Iterator<Pattern<T>> it = patterns.iterator();
    while (it.hasNext()) {
      Pattern<T> pattern = it.next();
      if (pattern.target().equals(target)) it.remove();
    }

    reverse.remove(target);
  }
410984
public static <T> void sort (List<T> a, Comparator<? super T> comp)
    {
        sort(a, 0, a.size() - 1, comp);
    }
1123954
private void sort(InstructionGroup group) {
        final InsnList instructions = method.instructions;
        Collections.sort(group.getNodes(), new Comparator<InstructionGraphNode>() {
            public int compare(InstructionGraphNode a, InstructionGraphNode b) {
                return Integer.valueOf(instructions.indexOf(a.getInstruction()))
                        .compareTo(instructions.indexOf(b.getInstruction()));
            }
        });
    }
992229
public static void sort(int[] data, int start, int end, IntComparator comp) {
    quickSort(data, start, end, comp);
  }
1003083
public Comparator<S> comparator() {
        if (mChunkMatcher == null) {
            return mChunkSorter;
        }
        return new Comparator<S>() {
            public int compare(S a, S b) {
                int result = mChunkMatcher.compare(a, b);
                if (result == 0) {
                    result = mChunkSorter.compare(a, b);
                }
                return result;
            }
        };
    }
1111174
private void sortMethodList() {

        // order of execution is base classes first, then the order of
        // processorClasses, reversed for tear downs

        // build up the order:
        final List<Class<?>> hierarchy = new ArrayList<Class<?>>();

        if (initialisationClasses != null) {
            for (int i = initialisationClasses.length; i > 0; i--) {

                hierarchy.addAll(classHierarchyFor(initialisationClasses[i - 1]));
            }
        }
        sortMethodLists(hierarchy);
    }
1247460
public static <T extends Class<?>> void sortByPriority(List<T> someClasses) {
        sortByPriority(someClasses, PriorityUtils::priorityOf);
    }
598764
public static Sort.Order toSortOrder(ComparatorItem comparatorItem) {
    if (comparatorItem == null || comparatorItem.getField() == null
        || comparatorItem.getField().trim().length() == 0) {
      return null;
    }
    Sort.Direction direction = comparatorItem.isAsc() ? Sort.Direction.ASC : Sort.Direction.DESC;
    Sort.NullHandling nullHandlingHint =
        comparatorItem.isNullIsFirst() ? Sort.NullHandling.NULLS_FIRST
            : Sort.NullHandling.NULLS_LAST;
    Sort.Order order = new Sort.Order(direction, comparatorItem.getField(), nullHandlingHint);
    if (comparatorItem.isIgnoreCase()) {
      return order.ignoreCase();
    }
    return order;
  }
671687
private void selectionSort(final T[] array, int start, int end, Comparator<T> lt) {
    int i;
    int j;
    int bestI;
    T tmp;
    for (i = start; i < end; i++) {
      bestI = i;
      for (j = i + 1; j < end; j++) {
        if (lt.compare(array[j], array[bestI]) < 0)
          bestI = j;
      }
      tmp = array[i];
      array[i] = array[bestI];
      array[bestI] = tmp;
    }
  }