操作符assing方法
- K key,
- V value
override
将给定的value
与key
关联。
如果key已经存在于map中,它的关联值将被更改。否则,将key/value对添加到map中。
实现
void operator []=(K key, V value) {
// Splay on the key to move the last node on the search path for
// the key to the root of the tree.
int comp = _splay(key);
if (comp == 0) {
_root = _root!._replaceValue(value);
// To represent structure change, in case someone caches the old node.
_splayCount += 1;
return;
}
_addNewRoot(_SplayTreeMapNode(key, value), comp);
}