my dog learned polymorphism*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 13884
    
  10

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
 
Similar Threads
why equals() and hashCode() should override
Doubt in Collections
HASHTABLE Problem
Confusion about HashCode
why am i getting a null value on fetching from map