O'Reilly logo
  • Oscar Chavoya Aceves thinks this is interesting:

A common source of bugs is the failure to override the hashCode method. You must override hashCode in every class that overrides equals. Failure to do so will result in a violation of the general contract for Object.hashCode, which will prevent your class from functioning properly in conjunction with all hash-based collections, including HashMap,


Cover of Effective Java™: Programming Language Guide


"You must." is too much to say. Your application might no use hash-codes at all. The hash codes of two "equal" objects must be the same, but this is irrelevant if you never call the hashCode() method.