Sets the comparator for the given column, to enable sorting.

@param col the column to set the comparator on.
@param comparator the comparator to set.
350482
public void setComparator(final int col, final Comparator comparator) {
		synchronized (this) {
			if (comparators == null) {
				comparators = new HashMap<>();
			}
		}

		if (comparator == null) {
			comparators.remove(col);
		} else {
			comparators.put(col, comparator);
		}
	}
634091
public void setVertexOrder(Comparator<String> comparator)
	{
	    if (vertex_ordered_list == null)
	        vertex_ordered_list = new ArrayList<String>(getGraph().getVertices());
	    Collections.sort(vertex_ordered_list, comparator);
	}
1232986
private void init() {
        if (initialized.compareAndSet(false, true)) {
            final RowSorter<? extends TableModel> rowSorter = table.getRowSorter();
            rowSorter.toggleSortOrder(1); // sort by date
            rowSorter.toggleSortOrder(1); // descending
            final TableColumnModel columnModel = table.getColumnModel();
            columnModel.getColumn(1).setCellRenderer(dateRenderer);
            columnModel.getColumn(2).setCellRenderer(sizeRenderer);
        }
    }
192472
public void addColumn(Column<T, ?> column, String headerName,
                          boolean sortable) {
        addColumn(column, headerName);
        column.setSortable(sortable);
        if (sortable) {
            defaultSortOrderMap.put(column, true);
        }
    }
157207
protected void setArraySeparator(String arraySeparator) {
        if (arraySeparator == null) {
            arraySeparator = StringUtils.EMPTY;
        }
        this.arraySeparator = arraySeparator;
    }
85491
public function setOrder($column, $order = self::ORDER_ASC): void
    {
        $this->orders = [];
        $this->addOrder($column, $order);
    }
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;
    }
393066
protected void registerFactorComparator(final FactorComparator<T> comparator) {
    if (null == comparator ||
        Integer.MAX_VALUE - this.getTotalWeight() < comparator.getWeight()) {
      throw new IllegalArgumentException("unable to register comparator." +
          " The passed comparator is null or has an invalid weight value.");
    }

    // add or replace the Comparator.
    this.factorComparatorList.put(comparator.getFactorName(), comparator);
    logger.debug(String.format("Factor comparator added for '%s'. Weight = '%s'",
        comparator.getFactorName(), comparator.getWeight()));
  }
73329
public static IntComparator rowComparator(Column<?> column, Sort.Order order) {
        IntComparator rowComparator = column.rowComparator();
        if (order == Sort.Order.DESCEND) {
            return ReversingIntComparator.reverse(rowComparator);
        } else {
            return rowComparator;
        }
    }
1042591
public static <T> Sequence<T> sort(final Sequence<T> sequence, final Comparator<T> comparator)
  {
    List<T> seqList = Sequences.toList(sequence, Lists.<T>newArrayList());
    Collections.sort(seqList, comparator);
    return BaseSequence.simple(seqList);
  }
121735
public void setSortColumns(java.util.Collection<Order> sortColumns) {
        if (sortColumns == null) {
            this.sortColumns = null;
            return;
        }

        this.sortColumns = new java.util.ArrayList<Order>(sortColumns);
    }
825957
@Override
  public LaxImmutableMapBuilder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
    this.immutableMapEntryOrdering = checkNotNull(valueComparator);
    return this;
  }
797589
@Override
    protected void defaultSort(Comparator<? super E> comparator)
    {
        FastList<E> list = comparator == null
                ? (FastList<E>) this.toSortedList()
                : (FastList<E>) this.toSortedList(comparator);
        this.lists.clear();
        this.lists.add(list);
    }
1252297
@SuppressWarnings({ "unchecked", "rawtypes" })
    static final <R> Comparator<Cell<R>> comparator() {
        return (Comparator<Cell<R>>) (Comparator) COMPARATOR;
    }
537558
public void sortReverse(final Comparator<T> comparator) {
    this.sort(comparator);
    for (int i = 0; i < this.size / 2; i++) {
      final T temp = this.elements[i];
      this.elements[i] = this.elements[this.size - i - 1];
      this.elements[this.size - i - 1] = temp;
    }
  }
501993
public void addComparator(Comparator<T> comparator, boolean ascending) {
		this.comparators.add(new InvertibleComparator<T>(comparator, ascending));
	}
678194
public Table sortOn(Comparator<Row> rowComparator) {
        Row row1 = new Row(this);
        Row row2 = new Row(this);
        return sortOn((IntComparator) (k1, k2) -> {
            row1.at(k1);
            row2.at(k2);
            return rowComparator.compare(row1, row2);
        });
    }