Java equals() and hashCode() Contract
The Java super class java.lang.Object defines two important methods: public boolean equals(Object obj) public int hashCode()public boolean equals(Object obj) public int hashCode() In this post, I will first show an example of a common mistake, and then explain how the equals() and hashCode() contract works. 1. A common mistake The common mistake is shown in … Read more