This week's book giveaway is in the Java in General forum. We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line! See this thread for details.
I know of no reason to create equals and hashcode methods for objects serialized by the HTTP - Servlet API session mechanisms. After all, it is the String name that is used to recover the object reference.
William Brogden wrote:I know of no reason to create equals and hashcode methods for objects serialized by the HTTP - Servlet API session mechanisms. After all, it is the String name that is used to recover the object reference.
For clusters, you need to implement Serializable to be able to write to and read from disk. I don't see why you would need equals() and hashCode() though.
It is a popular misconception that hashCode provides a unique identifier for an object. It does not. hashCode and equals are used for Object equality comparisons, not serialized retrieval.
Stinging nettles are edible. But I really want to see you try to eat this tiny ad: