File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Override methods equals,hashcode,." Watch "Override methods equals,hashcode,." New topic
Author

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
Howdy!

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.).

Yours,
Bu.


all events occur in real time
 
 
subject: Override methods equals,hashcode,.