I agree with the statement from this post What issues should be considered when overriding equals and hashCode in Java?
Use the same set of fields that you use to compute equals() to compute hashCode().
But i've some doubts :
- Is this absolutely necessary to have same fields ?
- If yes, what if I don't use same field ?
- Will it affect HashMap performance or HashMap Accuracy ?