HashSet implementation in java and how it uses hashing.

HashSet is the implementation of Set interface , It uses HashMap internally for holding the elements. HashMap stores all the elements as a key value pair but , in HashSet we have only one thing i.e values , so in HashMap we store all the values as key with same values for all the data.

Private Map map;
Object sameValueObject = new Object();
Public void add(Object element)

Because HashMap keys are unique , so it guarantees for uniqueness.