First, the correct way to write Hashcode:
The "principle" overrides the Hashcode () by using the attribute in Equals () to compare whether two objects are in a consistent condition.
{1}. A common approach is to use a linear combination of the attributes involved.
{2}. The combination coefficients involved in the linear combination process can be customized.
Note that the value after stitching cannot exceed the range of the shaping.
{3}. formula: int form of attribute 1 + c1* attribute 2 int form + c2* Property 3 int form + ...
"Tip" When a property is a reference type, if Hashcode () has been overridden, then the int form of the reference property is the direct invocation of the property's existing hashcode value.
The most typical is that this property is a string type, and the string type has rewritten the hashcode () method, so it can be used directly.
"Java programming" correctly rewrites Hashcode and EQUESL scenarios