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

The map will be sorted by value.

@param callable|null $comparator Accepts two values to be compared.

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

        return $this;
    }
144597
public function sortable($sortable)
    {
        foreach ($sortable as $column => $options) {
            $this->sortable[$column] = $options;
        }

        return $this;
    }
441116
public function sort(Sorting $sorting)
	{
		if (is_callable($sorting->getSortCallback())) {
			call_user_func(
				$sorting->getSortCallback(),
				$this->data_source,
				$sorting->getSort()
			);

			return $this;
		}

		$sort = $sorting->getSort();

		if (!empty($sort)) {
			$this->data_source->removeClause('ORDER BY');
			$this->data_source->orderBy($sort);
		} else {
			/**
			 * Has the statement already a order by clause?
			 */
			$this->data_source->clause('ORDER BY');

			if ($this->data_source instanceof Dibi\Fluent) {
				$reflection = new \ReflectionClass('Dibi\Fluent');
			} else {
				$reflection = new \ReflectionClass('DibiFluent');
			}

			$cursor_property = $reflection->getProperty('cursor');
			$cursor_property->setAccessible(true);
			$cursor = $cursor_property->getValue($this->data_source);

			if (!$cursor) {
				$this->data_source->orderBy($this->primary_key);
			}
		}

		return $this;
	}
609229
public static <V> V[] sort(V[] array, Comparator<? super V> comparator) {
        Arrays.sort(array, comparator);
        return array;
    }
536592
public function sort(callable $comparator = null) : Collection
    {
        return $this->pipe(
            function (array $value) use ($comparator) : array {
                $comparator !== null
                    ? usort($value, $comparator)
                    : sort($value);

                return $value;
            }
        );
    }
695399
public function compare($date, $comparator)
  {
    //check if the argument $date is an instance of this class
    if ( $date instanceof $this){
      $tmp = $date;
    }
    else {
      $tmp = new \bbn\time($date);
    }
    switch ( $comparator ){
      case $comparator === '>':  
        return $this->get_time() > $tmp->get_time(); 
        break;
      case $comparator === '>=':  
        return $this->get_time() >= $tmp->get_time(); 
        break;
      case $comparator === '<':  
        return $this->get_time() < $tmp->get_time(); 
        break;
      case $comparator === '<=':  
        return $this->get_time() <= $tmp->get_time(); 
        break;
      case $comparator === '=':  
        return $this->get_time() == $tmp->get_time(); 
        break;
    }
  }
98525
public function sort(callable $callback = null)
    {
        $items = $this->items;

        $callback = $callback ?: function ($a, $b) {
            return $a == $b ? 0 : (($a < $b) ? -1 : 1);

        };

        uasort($items, $callback);

        return new static($items);
    }
614273
function(comparator, comparatorNullsFirst)
  {
    var cmp = comparator ? createComparator( comparator, comparatorNullsFirst ) : this.comparator;

    if ( !isSorted( cmp, this ) )
    {
      this.map.sort( cmp );

      this.trigger( Collection.Events.Sort, [this] );
    }

    return this;
  }
1232386
public function sorted(callable $compare): self
    {
        $intervals = $this->intervals;
        usort($intervals, $compare);
        if ($intervals === $this->intervals) {
            return $this;
        }

        return new self(...$intervals);
    }
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));
    }
983086
public function vnSeparator(array $vnSeparator = null)
    {
        if ($vnSeparator !== null) {
            $this->vnSeparator = $vnSeparator;
            return $this;
        }
        return $this->vnSeparator;
    }
252455
public static Comparator comparator(final Mapper mapper, final boolean reverse){
        return new Comparator(){
            public int compare(Object o, Object o1) {
                return ((Comparable) mapper.map(reverse?o1:o)).compareTo(mapper.map(reverse?o:o1));
            }
        };
    }
524344
public function sort(callable $callback = null)
    {
        $items = $this->getArrayCopy();
        $callback ? uasort($items, $callback) : asort($items);
        return new static($items);
    }
2580
public function sort(callable $callback = null) : Stack
    {
        $values = $this->_sort($callback);
        $this->setValues($values);
        return $this;
    }
704218
public function compare($object1, $object2)
    {
        if (! self::isCastableToString($object1)) {
            throw new ComparatorException('$object1 (type: ' . gettype($object1) . ') is not castable to string.');
        }
        if (! in_array(gettype($object2), ['string', 'integer', 'double'])) {
            throw new ComparatorException('$object2 (type: ' . gettype($object2) . ') is not castable to string.');
        }
        return call_user_func("\\{$this->compareMode}", $object1, $object2);
    }
837456
public function sort(callable $compareFunction = null)
    {
        if (is_null($compareFunction) === true) {
            $compareFunction = function ($a, $b) {
                return $a > $b;
            };
        }
        $array = $this->getArrayCopy();
        usort($array, $compareFunction);
        $this->exchangeArray($array);

        return $this;
    }
95716
@Override
  public LaxImmutableMapBuilder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
    innerBuilder.orderEntriesByValue(valueComparator);
    return this;
  }