As per the below link
Hashcode and equals
So it is assumed that if 2 objects are equal (that is, equals() returns true), then their hashCodes() must retu
Actually the idea is that when you implemente the equals method you should implement the hashCode method, and if a.equals(b) then a.hashCode() == b.hashCode(). Although there isn't anything in the Java compiler or Runtime that enforces this.
equals
hashCode
a.equals(b)
a.hashCode() == b.hashCode()