Sorts the sequence in-place, based on an optional callable comparator.

@param callable|null $comparator Accepts two values to be compared.
Should return the result of a <=> b.

@return \PlanB\DS\Sequence
552349
public function sort(?callable $comparator = null): Sequence
    {
        $comparator ?
            $this->items->sort($comparator) :
            $this->items->sort();

        return $this;
    }
63782
@Override
  @SuppressWarnings("unchecked")
  public <E> Comparator<E> getOrderBy() {
    return ObjectUtils.defaultIfNull(ComparatorHolder.get(), ObjectUtils.defaultIfNull(
      orderBy, ComparableComparator.INSTANCE));
  }
710544
public function withSortOrder(string $sortOrder)
    {
        $sortOrder = strtolower($sortOrder);
        Assert::oneOf($sortOrder, ['asc', 'desc']);

        $filters = clone $this;
        $filters->sortOrder = $sortOrder;

        return $filters;
    }
1101031
public function withSeparator(string $separator): self
    {
        if ($separator === $this->separator) {
            return $this;
        }

        $clone = clone $this;
        $clone->separator = $this->filterSeparator($separator);

        return $clone;
    }
542908
@ReplacedBy("com.google.common.collect.Ordering.natural().nullsLast()")
    public static final <T extends Comparable<?>> Comparator<T> comparable ()
    {
        @SuppressWarnings("unchecked") Comparator<T> comp = (Comparator<T>)COMPARABLE;
        return comp;
    }
716911
public function reverse()
    {
        if ($this->getComparator() instanceof ReverseComparator) {
            $this->setComparator($this->getComparator()->getOriginalComparator());
        } else {
            $this->setComparator(new ReverseComparator($this->getComparator()));
        }
        return $this;
    }
103208
public function ksort(callable $comparator = null)
    {
        if ($comparator) {
            usort($this->pairs, function($a, $b) use ($comparator) {
                return $comparator($a->key, $b->key);
            });

        } else {
            usort($this->pairs, function($a, $b) {
                return $a->key <=> $b->key;
            });
        }
    }
846727
protected function sortCompare($a, $b, $sorting)
    {
        $position = 0;

        foreach ($sorting as $key=>$direction) {

            $left = $this->extractor->value($a, $key);
            $right = $this->extractor->value($b, $key);

            $position = $this->applyDirection($this->sortCompareValues($left, $right), $direction);

            if ($position !== 0) {
                return $position;
            }
        }

        return $position;

    }
825957
@Override
  public LaxImmutableMapBuilder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
    this.immutableMapEntryOrdering = checkNotNull(valueComparator);
    return this;
  }
121760
public static ComparatorItem fromSort(Sort sort) {
    if (sort == null) {
      return null;
    }
    ComparatorItem comparatorItem = null;
    for (Order order : sort) {
      ComparatorItem item = fromSortOrder(order);
      if (item != null) {
        if (comparatorItem == null) {
          comparatorItem = item;
        } else {
          comparatorItem.getLastComparatorItem().setNextComparatorItem(item);
        }
      }
    }
    return comparatorItem;
  }
609229
public static <V> V[] sort(V[] array, Comparator<? super V> comparator) {
        Arrays.sort(array, comparator);
        return array;
    }
651959
public function ksorted(?callable $comparator = null): MapInterface
    {
        $items = $comparator ?
            $this->items->ksorted($comparator) :
            $this->items->ksorted();

        return $this->duplicate($items);
    }
149541
protected function sortCompareValues($a, $b)
    {
        if (is_numeric($a) && is_numeric($b)) {
            return $this->sortCompareNumeric((float)$a, (float)$b);
        }

        if (is_string($a) && is_string($b)) {
            return $this->sortCompareStrings($a, $b);
        }

        return ($a < $b) ? -1 : (int)($a > $b);
    }
960412
public BeanQuery<T> orderBy(Comparator... beanComparator) {
    this.comparator = new DelegatedSortOrderableComparator(ComparatorUtils.chainedComparator(beanComparator));
    return this;
  }
942829
public void sortRows(Comparator<List<String>> comparator)
	{
		if(data.isEmpty())
			return;
		
		Collections.sort(data, comparator);
	}
1157763
@NotNull
    @SuppressWarnings("unchecked")
    public static <T extends Comparable<? super T>> ComparatorCompat<T> reverseOrder() {
        return (ComparatorCompat<T>) REVERSE_ORDER;
    }
1184926
public function sortByKey(ComparerInterface $comparer = null)
    {
        if ($comparer === null) {
            $comparer = $this->getDefaultComparer();
        }
        uksort($this->container, array($comparer, 'compare'));

        return $this;
    }