In a correct implementation of equals
and hashCode
you have the following implications for two objects a
and b
(that are not null
):
if a == b
then also a.equals(b)
if a.equals(b)
then also a.hashCode() == b.hashCode()
Both implications cannot be reversed in general.