SHARE
TWEET

Untitled

a guest Jan 12th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let's say I create hashset<employee> set = new hashSet();
  2. employee e1 = new employee("adithyan",1);
  3. employee e2 = new employee("santhosh",1);
  4. employee e3 = new employee("pavan",2);
  5.    
  6. 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?
  7.  
  8. 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!
  9.  
  10. can somebody explain how hashset uses hastable with same hashcode and bucketing concept?
RAW Paste Data
Top