jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Override methods equals,hashcode,. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Override methods equals,hashcode,." Watch "Override methods equals,hashcode,." New topic

Override methods equals,hashcode,.

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
The super class for the all class is "Object",which has some many method,in which equals,hashcode,.That methods are override in the following class like HashMap,HashTable,
But why in HashSet,ArrayList classes doesn't override these methods?.
What are the main reason for?
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274

Regarding hashCode there is no difference between the classes you mentioned: HashMap, Hashtable, HashSet and ArrayList.

All of these do not override the hashCode method because it is already overidden in their respective superclasses (AbstractMap, AbstractSet etc.).


all events occur in real time
I agree. Here's the link: http://aspose.com/file-tools
subject: Override methods equals,hashcode,.
It's not a secret anymore!