Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let's say I create hashset<employee> set = new hashSet();
- employee e1 = new employee("adithyan",1);
- employee e2 = new employee("santhosh",1);
- employee e3 = new employee("pavan",2);
- set.add(e2); -- let's say e1 and e2 hashcode are same and value gets stored in same bucket and if I do search on id=1, how it will search because e1 and e2 hashcodes are same, probably e1 and e2 would be stored in same bucket, what would be the result for this?
- I am confused with bucketing which has more than one objects along with objects has same data(let's say bucket1->object1.name=san,object2.city=bglr,object2.city.=bglr)- in this case hashcode will be the same because both objects are in same bucket, I don't know how searching would work!
- can somebody explain how hashset uses hastable with same hashcode and bucketing concept?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement