When a Java class overrides the equals method, it should override the hashCode method as well. As defined in the method's contract:
Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, ...