The hashset calculates the hash of the object and is based on this hash, saves the object in the structure for quick search. As a result, by contract, when an object is added to the dictionary, the hash cannot be changed . Most good hash functions will depend on the number of elements and the elements themselves.
The tuple is unchanged, therefore, after construction, the values cannot change, and therefore the hash cannot change (or, at least, a good implementation should not allow the hash to be changed).
The list on the other hand has been changed: later you can add / remove / change items. As a result, a hash can change a breach of contract.
Thus, all objects that cannot guarantee a hash function that remains stable after adding an object violate the contract and, therefore, are not good candidates. Because to search, the dictionary will first calculate the hash of the key and determine the correct bucket. If the key is changed, this can lead to false negatives: the object is in the dictionary, but it can no longer be restored, because the hash is different from the other, therefore, a search is made for another bucket, except where the object was originally added to.
source share