how hashset works internally in java?

HashSet uses HashMap internally to store its elements. When we create a HashSet, internally a HashMap is created. The elements inserted in HashSet are actually inserted as the keys in HashMap.

Kindly click here to look at internal working of HashMap to see how hashset works internally.

Please Share