previous | start | next

The contract between equals and hashCode

If equals is overriden by a class, then hashCode should also be overriden and this condition (the contract) should be satisfied for any variables x and y of the class:

      if  x.equals(y) is true, then x.hashCode() should == y.hashCode()
   


previous | start | next