Understanding the generated hash code override in Java, line by line
When you override
equals() in a Java class, you should also override
hashCode(). You can certainly write
equals() yourself and then have your integrated development environment (IDE) generate
hashCode() for you.
There’s nothing wrong with that, provided that you understand what was generated and why. That’s what this article is about.