This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes equals() & hashCode() method in Object class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "equals() & hashCode() method in Object class" Watch "equals() & hashCode() method in Object class" New topic
Author

equals() & hashCode() method in Object class

shan sundaram
Greenhorn

Joined: Feb 07, 2004
Posts: 15
Hi,
What is the use of equals() & hashCode() method? where/how to use it?

Thanks in advance,
V.Shanmugam.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have you looked at the JavaDocs for the Object class?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Eitan Levi
Greenhorn

Joined: Jun 14, 2006
Posts: 14
In case you're asking because you're interested in overriding them for your own classes, there's a really good article on JavaWorld: How to avoid traps and correctly override methods from java.lang.Object. It shows you how to properly override the equals and hashCode methods.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: equals() & hashCode() method in Object class
 
Similar Threads
map method containsKey
hashCode and equals
HashSet ordering
hashCode() implementation