关于hastable的问题
Basically, when you add a key/value pair to a Hashtable or Dictionary object, a hash code
for the key object is obtained first. This hash code indicates which "bucket" the key/value
pair should be stored in. When the Hashtable/Dictionary object needs to look up a key,
it gets the hash code for the specified key object. This code identifies the "bucket" that is
now searched sequentially, looking for a stored key object that is equal to the specified key
object. Using this algorithm of storing and looking up keys means that if you change a key object
that is in a Hashtable/Dictionary, the Hashtable/Dictionary will no longer be able to find
the object. If you intend to change a key object in a hash table, you should remove the original
object/value pair, modify the key object, and then add the new key object/value pair back
into the hash table.
------有点疑惑。想问一下。上文中说的修改键值的时候为什么需要先删除,再添加呢。为什么不能直接修改呢。我没有理解这是为什么呢?