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.
The moose likes Beginning Java and the fly likes Expain me what is hashCode() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Expain me what is hashCode() method" Watch "Expain me what is hashCode() method" New topic
Author

Expain me what is hashCode() method

sandip sangale
Greenhorn

Joined: Jun 22, 2009
Posts: 15


1) why to override hashCode() method
we what difference it makes when override.
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

See why we need to override hashcode when write equality method in Java here


http://muhammadkhojaye.blogspot.com/
Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
The article actually says how to override those methods, not why we should.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14950
    
  26

Alessandro Ilardo wrote:The article actually says how to override those methods, not why we should.

Really? Pitfall #2 in the article explains quite clearly what hashCode() is used for, so this makes it clear when and why you should implement a hashCode() method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Expain me what is hashCode() method
 
It's not a secret anymore!