What happens if we override equals?

Only Override HashCode, Use the default Equals: Only the references to the same object will return true . In other words, those objects you expected to be equal will not be equal by calling the equals method. Only Override Equals, Use the default HashCode: There might be duplicates in the HashMap or HashSet.

Read more