Set collection presentation

HashSet source line 312.

   For HashSet concerned, it is based, underlying HashSet HashMap implemented using HashMap to hold all the elements, so HashSet is easy to implement, HashSet related operations are basically related to directly call a method to accomplish the underlying HashMap

Hash value as the case where the call equals () method, the determination target the same memory address.

If the same, no deposit. If not, the hash resolve the conflict (refer hashMap solution to the conflict hash) deposit into the HashSet.

 

treeSet source line 539

Similarly with treeMap bottom, red-black tree.

Guess you like

Origin www.cnblogs.com/KFKang/p/12037621.html