Understanding the generated equality override in Java, line by line

Alonso Del Arte
Jan 15, 2020 · 16 min read
Photo by Rachael Gorjestani on Unsplash

When you override hashCode() 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, the third of three…