Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Override methods equals,hashcode,.

 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic