«
^
»
4.3. Providing a hashCode method that returns the value 0
The implications of these rules are not easy to understand.
To begin with, I find it easier to advise students to provide classes with:
public int hashCode() { return 0; }
When this function is called, it always returns the same value, and so this
hashCode
satisfies the first two rules.
The third rule says we will get poor execution speeds using this
hashCode
.