aspose file tools
The moose likes Java in General and the fly likes Using the equals and Hashcode methods of an Object? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Using the equals and Hashcode methods of an Object?" Watch "Using the equals and Hashcode methods of an Object?" New topic
Author

Using the equals and Hashcode methods of an Object?

PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212


I have an Employee Object with Age and Name as parameters , i had generated equals and hashcode methods for this Object to avoid duplicates.

Can anybody please tell me where these two methods will be useful actually ??

what i think is that while doing (rs.next()) on to DAO layer and setting the Bean in a List , or am i wrong will this be used somewhere else ?? Please tell me .
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

It can be used by your code directly and also in other areas such as the Comparators and searching for objects in Lists etc.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using the equals and Hashcode methods of an Object?
 
Similar Threads
The hashCode() e equals() methods was overriden
Comparator doubt
Confusion with hashCode() and equals() method
hashCode() & equals() method test
Doubt in K&B 5: Which equals() method is better?