Add equals and hashcode methods.