src/Collection/ImmArray.php
protected function heapSort(callable $cb)
    {
        $h = new CallbackHeap($cb);
        foreach ($this as $el) {
            $h->insert($el);
        }

        return static::fromItems($h);
    }
protected function heapSort(callable $cb)
    {
        $h = new CallbackHeap($cb);
        foreach ($this as $el) {
            $h->insert($el);
        }

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

@param callable $cb The comparison callback
@return static
Sort by applying a CallbackHeap and building a new heap Can be efficient for sorting large stored objects .