replace


Description:

public void replace (owned K key, owned V value)

Inserts a new key and value into a Tree similar to insert.

The difference is that if the key already exists in the Tree, it gets replaced by the new key. If you supplied a value_destroy_func when creating the Tree, the old value is freed using that function. If you supplied a key_destroy_func when creating the Tree , the old key is freed using that function.

The tree is automatically 'balanced' as new key/value pairs are added, so that the distance from the root to every leaf is as small as possible.

Parameters:

this

a Tree

key

the key to insert

value

the value corresponding to the key