| Author |
Overriding equals() & hashcode() in collections
|
ramya narayanan
Ranch Hand
Joined: Oct 06, 2008
Posts: 338
|
|
Dear all, What is the need for overriding equals() & hashcode() in Collections . Normally every instance by default inherits Object class which has equals() & hashcode() . Then why we should override it? Regards.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32704
|
|
java NameDemo ramya ramya See what comes out. You need to have two identical objects recoognised as identical to each other for the Collections to work.
|
 |
 |
|
|
subject: Overriding equals() & hashcode() in collections
|
|
|