This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
For instance, if two of your objects are always distinct
How the java runtime will understand that the object are distinct or how the jre will tell two user defined objects are equal?
The object class equals only check for references. Say for example for a Employee class objects may be treated equals depending on there dept and experience property not by looking at reference only.
Exactly, and this is why you would override the equals method. A lot of classes use the equals method to see when two objects are distinct or equal. You can override this method to provide your own understanding of when two objects are equal.
Keep in mind that whenever you override equals, you *must* override hashCode as well. Take a good look at the documentation for these methods.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Why we implement hashcode and equals() method while working with Hashtable and hashMap ?