Add a Comparator to the end of the chain using the provided sort order.
@param comparator the Comparator to add to the end of the chain
@param ascending the sort order: ascending (true) or descending (false)
501993
public void addComparator(Comparator<T> comparator, boolean ascending) {
		this.comparators.add(new InvertibleComparator<T>(comparator, ascending));
	}
10872
public <T> void sort(List<T> list, Comparator<T> cmp)
    {
        if(index.size() < list.size())
            for(int i = index.size(); i < list.size(); i++ )
                index.add(i);
        if(list.size() == index.size())
            Collections.sort(index, new IndexViewCompList(list, cmp));
        else
        {
            Collections.sort(index);//so [0, list.size) is at the front
            Collections.sort(index.subList(0, list.size()), new IndexViewCompList(list, cmp));
        }
        prevSize = list.size();
    }
1365508
public Comparator<Integer> comparator() {
        return new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                Http2PriorityNode n1 = nodesByID.get(o1);
                Http2PriorityNode n2 = nodesByID.get(o2);
                if(n1 == null && n2 == null) {
                    return 0;
                }
                if(n1 == null) {
                    return -1;
                }
                if(n2 == null) {
                    return 1;
                }
                //do the comparison
                //this is kinda crap, but I can't really think of any better way to handle this

                double d1 = createWeightingProportion(n1);
                double d2 = createWeightingProportion(n2);
                return Double.compare(d1, d2);
            }
        };
    }
385530
def _append_sorted(root, el, comparator):
    
    for child in root:
        rel = comparator(el, child)
        if rel > 0:
            # el fits inside child, add to child and return
            _append_sorted(child, el, comparator)
            return
        if rel < 0:
            # child fits inside el, move child into el (may move more than one)
            _append_sorted(el, child, comparator)
    # we weren't added to a child, so add to root
    root.append(el)
979398
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
        columnSortHandler.setComparator(column, comparator);
    }
960412
public BeanQuery<T> orderBy(Comparator... beanComparator) {
    this.comparator = new DelegatedSortOrderableComparator(ComparatorUtils.chainedComparator(beanComparator));
    return this;
  }
532526
protected function addSort(QueryBuilder $queryBuilder, $sortField, $sortAscending)
    {
        if ($sortField !== null) {

            $type = $this->definition->getType($sortField);
            if ($type === 'many') {
                $sortField = $this->definition->getInitialSortField();
            }

            $order = $sortAscending === true ? 'ASC' : 'DESC';
            $queryBuilder->orderBy('`'.$sortField.'`', $order);
        }
    }
698922
public static <T> T[] sort(T[] self, Comparator<T> comparator) {
        return sort(self, true, comparator);
    }
484971
public void order() {
        Collections.sort(cells, new Comparator<SortedSet<Integer>>() {

            @Override
            public int compare(SortedSet<Integer> cellA, SortedSet<Integer> cellB) {
                return cellA.first().compareTo(cellB.first());
            }

        });
    }
696160
public Comparator<T> thenComparing(final java.util.Comparator<? super T> other) {
            final Comparator<T> me = this;
            return new Comparator<T>() {
                @Override
                public int compare(T o1, T o2) {
                    int ret = (me.compare(o1, o2));
                    return (0 == ret) ? other.compare(o1, o2) : ret;
                }
            };
        }
942829
public void sortRows(Comparator<List<String>> comparator)
	{
		if(data.isEmpty())
			return;
		
		Collections.sort(data, comparator);
	}
1106517
public static <T> Comparator<T> comparator(CheckedComparator<T> comparator) {
        return comparator(comparator, THROWABLE_TO_RUNTIME_EXCEPTION);
    }
1167547
public function sort(callable $comparator = null)
    {
        $copy = array_merge($this->value);

        if ($comparator === null) {
            return static::of(sort($copy));
        }

        return static::of(usort($copy, $comparator));
    }
1059348
function SortOrderComparator(sortOrder, options) {
        this.sortOrder = sortOrder;
        this.options = {
            casesensitive: false
        };
        if (options) {
            _.extend(this.options, options);
        }
        this.expressions = new Array(sortOrder.sortFields.length);
        for (var i = 0; i < this.expressions.length; ++i) {
            this.expressions[i] = new JsonPath_1.JsonPath(sortOrder.sortFields[i].name);
        }
    }
528318
public static <T> List<T> sort(List<T> list, Comparator<? super T> comparator) {
        Collections.sort(list, comparator);
        return list;
    }
1337525
public static <T extends Extendable> List<T> sort(final List<T> values, final Sort sort, final boolean ascending) {
        final SortableList<T> list = getSortableList(values);
        list.sortOnProperty(sort, ascending, new SortStrategy());
        return list;
    }
1369088
public void addSort(WritableComparable<?> writable, int sort, int priority) {
        key.addHadoopValue(String.format(SORT_LABEL, priority), writable, sort, priority);
    }