Re:Project Valhalla: A look inside Java's epic refactor
by kaba0 on Sunday December 03, 2023 @10:01AM
(#38507514)
Arguably, equality has no default, meaningful implementation. Object identity is a good default, while data-like objects=records should have the trivial equality in place. But a connection is not equal to any other, even if their internal state is equivalent.
In an ideal world, == would test for equality. In a worse world, equals() would test for equality. But we live in a Java world: Equals() is predefined as an identity check on Objects, and it's up invididual implementations to override that check with something better.