Can anyone please clarify when we check equality on collections, equals() method is called on incoming object or on those objects which are there in collection. for ex.
If a Set or a Hashmap has objects object1, object2 and object3 and a fourth object called object4 tries to get into the Set or it is compared with the already existing three objects in case of hashmap then equals() method is called on this fourth object and the already existing three objects are passed one by one or reverse is true.?
No comments:
Post a Comment