Wiki Markup |
---|
According to the Java API \[[API 062006|AA. Java References#API 06]\] class {{java.lang.Object}} documentation: |
...
Wiki Markup |
---|
This compliant solution shows how the {{hashCode()}} method can be overridden so that the same value is generated for any two instances that compare equal when {{Object.equals()}} is used. Bloch discusses the recipe to generate such a hash function in good detail \[[Bloch 082008|AA. Java References#Bloch 08]\]. |
...
References
Wiki Markup |
---|
\[[API 062006|AA. Java References#API 06]\] [Class Object|http://java.sun.com/javase/6/docs/api/java/lang/Object.html] \[[Bloch 082008|AA. Java References#Bloch 08]\] Item 9: Always override {{hashCode}} when you override {{equals}} \[[MITRE 092009|AA. Java References#MITRE 09]\] [CWE ID 581|http://cwe.mitre.org/data/definitions/581.html] "Object Model Violation: Just One of Equals and Hashcode Defined" |
...