In my implementation, I have a class A that overrides equals (Object) and hashCode (). But I have little doubt that when adding an instance of A to the HashSet / HashMap, the value of hashCode () is x, after which the value of the same hashCode () changes to y. Will it be something?
The hash code should not change after it is added to the map / set. This is normal if it changes before, although it usually simplifies working with the type if it does not change.
If the hash code changes, the key will not be found in the map / set, because even if it appears in the same bucket, the hash code will be changed first.
hashCode() equals() , HashMap/HashSet .., undefined ( ). , ..
hashCode()
equals()
HashMap
HashSet
( HashSet ..). , , python . / Java, " ". .
, , , .
hashCode() equals(), , . , , .
, - . , ( ); .
: , . , hashCode equals, . ( ), .
hashCode
equals
. , . - - - -:
, "", "GreatMike" . , - "", .