
Before we go ahead and explore Apache Commons EqualsBuilder and HashCodeBuilder we must know the relationship between equals and hashCode. java.lang.Object which is the super class of all Java classes has two very important methods defined in it. They are -
* public boolean equals(Object obj) * public int hashCode()
These two methods are very important when our classes deal with other Java classes such as Collection API used for searching, sorting, comparison and eliminate duplicate objects from a set.
|