hashCode property
The hash code for this object.
A hash code is a single integer which represents the state of the objectthat affectsoperator == comparisons.
All objects have hash codes.The default hash code implemented byObjectrepresents only the identity of the object,the same way as the defaultoperator == implementation only considers objectsequal if they are identical (seeidentityHashCode).
Ifoperator == is overridden to use the object state instead,the hash code must also be changed to represent that state,otherwise the object cannot be used in hash based data structureslike the defaultSet andMap implementations.
Hash codes must be the same for objects that are equal to each otheraccording tooperator ==.The hash code of an object should only change if the object changesin a way that affects equality.There are no further requirements for the hash codes.They need not be consistent between executions of the same programand there are no distribution guarantees.
Objects that are not equal are allowed to have the same hash code.It is even technically allowed that all instances have the same hash code,but if clashes happen too often,it may reduce the efficiency of hash-based data structureslikeHashSet orHashMap.
If a subclass overrideshashCode, it should override theoperator == operator as well to maintain consistency.
Implementation
external int get hashCode;