public function unique(?callable $callback = null): ArrayCollection
    {
        if ($callback === null) {
            return new static(array_unique($this->items, SORT_REGULAR));
        }
        $set = [];

        return $this->filter(function ($value, $key) use ($callback, &$set) {
            $hash = $callback($value, $key);
            if (isset($set[$hash])) {
                return false;
            }
            $set[$hash] = true;

            return true;
        });
    }