{@inheritdoc}

Uses sorting by priority.
160914
public function process(Request $request, Response $response)
    {
        // Conditionally add jQuery
        $this->addJquery($request, $response);

        /** @var FileAssetInterface $asset */
        foreach ($this->sort($this->javascript) as $key => $asset) {
            $this->processAsset($asset, $request, $response);
            unset($this->javascript[$key]);
        }

        /** @var FileAssetInterface $asset */
        foreach ($this->sort($this->stylesheet) as $key => $asset) {
            $this->processAsset($asset, $request, $response);
            unset($this->stylesheet[$key]);
        }
    }
303077
static protected function sortInjection(BasicInjectionContract $a, BasicInjectionContract $b)
    {
        if ($a->priority() == $b->priority()) {
            return 0;
        }

        return ($a->priority() < $b->priority()) ? - 1 : 1;
    }
655102
public function setHandlerPriority(KCommandHandlerInterface $handler, $priority)
    {
        $this->__queue->setPriority($handler, $priority);
        return $this;
    }
397497
public function setPriority($p)
    {
        $this->priority = $p;
        if ($this->ev !== null) {
            $this->ev->priority = $p;
        }
    }
1182805
public function sortingPriority($key)
    {
        $this->bootCanSortMethodsOnce();

        if (!isset($this->sorting[$key])) {
            return 0;
        }

        return array_search($key, array_keys($this->sorting)) + 1;
    }
15829
public function setPriority(AnObjectHandlable $object, $priority)
    {
        if ($handle = $object->getHandle()) {
            if ($this->_priority_list->offsetExists($handle)) {
                $this->_priority_list->offsetSet($handle, $priority);
                $this->_priority_list->asort();
            }
        }

        return $this;
    }
678571
public function priorityIs($value)
    {
        $this->add(new Criterium(self::CRITERIUM_PRIORITY_IS, (int) $value));

        return $this;
    }
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
        }
    }
1361407
function sortMultiOptions()
    {
        usort( $this->Options, function( $a, $b ) {
            if ( $a['priority'] == $b['priority'] )
            {
                return 0;
            }

            return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
        });
        $this->changeMultiOptionID();
    }
438220
public function remove_item_by_priority( $priority = 0 ) {
		// Search all items for the same priority.
		$all_items = $this->get_items();
		if ( array_key_exists( $priority, $all_items ) ) {
			// Remove all items with that priority.
			unset( $all_items[ $priority ] );
		}

		// Update the items.
		$this->set_items( $all_items );
	}
160059
public function setPriority(ObjectHandlable $object, $priority)
    {
        if($handle = $object->getHandle())
        {
            if($this->__priority_list->offsetExists($handle))
            {
                $this->__priority_list->offsetSet($handle, $priority);
                $this->__priority_list->asort();
            }
        }

        return $this;
    }
568373
protected function sortByPriority(array $list) : array
    {
        $nonPriorityItems = [];
        $priorityItems = [];

        foreach ($list as $key => $priority) {
            if ($priority == -1) {
                $nonPriorityItems[] = $key;
            } else {
                $priorityItems[$key] = $priority;
            }
        }

        asort($priorityItems);

        return array_merge(array_keys($priorityItems), $nonPriorityItems);
    }
1135389
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)) {
			foreach ($sort as $column => $order) {
				$this->data_source->addOrderBy($this->checkAliases($column), $order);
			}
		} else {
			/**
			 * Has the statement already a order by clause?
			 */
			if (!$this->data_source->getDQLPart('orderBy')) {
				$this->data_source->orderBy($this->checkAliases($this->primary_key));
			}
		}

		return $this;
	}
151458
protected function getIndexingPriority()
    {
        $priority = 0;

        if (!empty($this->indexingConfiguration['indexingPriority'])) {
            $priority = (int)$this->indexingConfiguration['indexingPriority'];
        }

        return $priority;
    }
19027
public function setPriority($priority)
    {
        if (!OptionsPriorities::isValid($priority)) {
            throw new InvalidOptionsException('priority is not valid, please refer to the documentation or use the constants of the class "OptionsPriorities"');
        }
        $this->priority = $priority;

        return $this;
    }
731978
public function sort($order = 'asc')
    {
        if ($order == 'desc') {
            rsort($this->_map);
        }else{
            sort($this->_map);
        }

        return $this;
    }
1047934
public static function on($event, $fn, $priority = 0)
    {
        if (!static::bound($event)) {
            static::$events[$event] = [];
        }

        static::$events[$event][] = new Listener($fn, $priority);

        uasort(static::$events[$event], function (Listener $a, Listener $b) {
            return $a->getPriority() < $b->getPriority();
        });
    }