public function offsetSet($key, $value)
    {
        if ($this->root) {
            $this->root = $this->root->insert($key, $value, $this->comparator);
        } else {
            $this->root = TreeNode::create($key, $value);
        }
    }