        }

        return this._compareFunc(this._store[indexA]!, this._store[indexB]!);
    }


    /**
     * Swaps the items at the specified indices
     * @param indexA - Index of an item to swap
     * @param indexB - Index of an item to swap
     */
    private swap(indexA: number, indexB: number): void
    {
        if (!this.isValidIndex(indexA) ||
            !this.isValidIndex(indexB))