Qaribou\Collection\ImmArray::heapSort PHP Méthode

heapSort() protected méthode

Sort by applying a CallbackHeap and building a new heap Can be efficient for sorting large stored objects.
protected heapSort ( callable $cb ) : ImmArray
$cb callable The comparison callback
Résultat ImmArray
    protected function heapSort(callable $cb)
    {
        $h = new CallbackHeap($cb);
        foreach ($this as $el) {
            $h->insert($el);
        }
        return static::fromItems($h);
    }