Sorts the given list using the given comparator.
961461
public static <T> void sort(List<T> list, Comparator<? super T> comparator) {
		if (list instanceof RandomAccess) {
			quicksort(list, comparator);
		} else {
			List<T> copy = new ArrayList<>(list);
			quicksort(copy, comparator);
			list.clear();
			list.addAll(copy);
		}
	}
829464
public void rsort ()
    {
        sort(new Comparator<T>() {
            public int compare (T o1, T o2) {
                return _comp.compare(o2, o1);
            }
        });
    }
220034
function indexOf(list, element, comparator) {
			for (var i=0,item; item=list[i]; i++) {
				if (equals(item, element, comparator)) {
					return i;
				}
			}
			return -1;
		}
656315
public static <T, V extends Comparable<? super V>, L extends List<T>> L sortThisBy(L list, Function<? super T, ? extends V> function)
    {
        return Iterate.sortThis(list, Comparators.byFunction(function));
    }
874337
private void sortCandidateList(ArrayList list) {
    java.util.Collections.sort(list, new java.util.Comparator() {
      public int compare(Object o1, Object o2) {
        // First sort, by score in index
        double scoreT = ( (Candidates) o1).getScore(),
            scoreU = ( (Candidates) o2).getScore();
        if (scoreU > scoreT) {
          return 1;
        }
        if (scoreU < scoreT) {
          return -1;
        }
        return 0;
      }
    }
    );
  }
832735
public void sort(@NonNull Comparator<? super T> comparator) {
        final ArrayList<T> copy = new ArrayList<>(mObjects);
        Collections.sort(copy, comparator);
        swap(copy);
    }
942829
public void sortRows(Comparator<List<String>> comparator)
	{
		if(data.isEmpty())
			return;
		
		Collections.sort(data, comparator);
	}
1347541
@Deprecated
    public static <T> void sort(T[] array, int size, Comparator<? super T> comparator)
    {
        if (comparator == null)
        {
            Arrays.sort(array, 0, size); // handles case size < 2 in Java 8 ComparableTimSort
        }
        else
        {
            Arrays.sort(array, 0, size, comparator); // handles case size < 2 in Java 8 TimSort
        }
    }
961715
public static <T> List<T> sorted(Iterable<T> items, Comparator<T> comparator) {
    List<T> result = toList(items);
    Collections.sort(result, comparator);
    return result;
  }
1259956
private static <T extends Comparable<? super T>> void sort(T[] a, int n) {
        int inc = 1;
        do {
            inc *= 3;
            inc++;
        } while (inc <= n);

        do {
            inc /= 3;
            for (int i = inc; i < n; i++) {
                T v = a[i];
                int j = i;
                while (a[j - inc].compareTo(v) < 0) {
                    a[j] = a[j - inc];
                    j -= inc;
                    if (j < inc) {
                        break;
                    }
                }
                a[j] = v;
            }
        } while (inc > 1);
    }
464598
private void sortPoints() {
		final ControlPoint firstPt = (ControlPoint)list.get(0);
		final ControlPoint lastPt  = (ControlPoint)list.get(list.size()-1);
		Comparator compare = new Comparator() {
			public int compare(Object first, Object second) {
				if (first == firstPt) {
					return -1;
				}
				if (second == lastPt) {
					return -1;
				}
				
				float a = ((ControlPoint) first).pos;
				float b = ((ControlPoint) second).pos;
				return (int) ((a-b) * 10000);
			}
		};
		Collections.sort(list, compare);
	}
1140762
protected List<T> sort(final List<T> unsortedList)
	{
		final SortParam<S> sortParam = getSort();
		if (sortParam != null)
		{
			final String property = (String)sortParam.getProperty();
			final boolean ascending = sortParam.isAscending();
			ListExtensions.sortByProperty(unsortedList, property, ascending);
		}
		return unsortedList;
	}
1031048
public void sort() {
        PriorityQueue<Op.Pair<Term, Double>> termCentroids
                = new PriorityQueue<Op.Pair<Term, Double>>(
                        terms.size(), new Ascending());
        Defuzzifier defuzzifier = new Centroid();
        for (Term term : terms) {
            double centroid;
            try {
                if (term instanceof Constant || term instanceof Linear) {
                    centroid = term.membership(0);
                } else {
                    centroid = defuzzifier.defuzzify(term, getMinimum(), getMaximum());
                }
            } catch (Exception ex) {
                centroid = Double.POSITIVE_INFINITY;
            }
            termCentroids.offer(new Op.Pair<Term, Double>(term, centroid));
        }

        List<Term> sortedTerms = new ArrayList<Term>(terms.size());
        while (!termCentroids.isEmpty()) {
            sortedTerms.add(termCentroids.poll().getFirst());
        }
        setTerms(sortedTerms);
    }
700340
public static <E extends Comparable<E>> void sort(List<E> list) {
        while(!Sort.isSorted(list)) {
            FYShuffle.shuffle(list);
        }
    }
767679
public static <T> void rsort (List<T> a, Comparator<? super T> comp)
    {
        sort(a, Collections.reverseOrder(comp));
    }
546022
public static <E extends Comparable<E>> void sortDescending(List<E> list) {
        while(!Sort.isReverseSorted(list)) {
            FYShuffle.shuffle(list);
        }
    }
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);
        }
    }