The main difference between a HashSet and a HashMap are:
1. Base class: A HashSet class implements the Set interface.
Whereas a HashMap class implements the Map interface.
2. Storage: A HashSet is used to store distinct objects. A
HashMap is used for storing key & value pairs, so that
these can be retrieved by key later on.
3. Duplicate Elements: A HashSet does not allow storing
duplicate elements. A HashMap also does not allow
duplicate keys. But we can store duplicate values in a
HashMap.
4. Null Elements: In a HashSet we can store a single null
value. In a HashMap we can store single null key, but any
number of null values.
5. Element Type: A HashSet contains only values of objects
as its elements. Whereas a HashMap contains entries(key
value pairs).
6. Iteration: By using an Iterator we can iterate a HashSet.
But a HashMap has to be converted into Set for iteration.
https://www.geeksforgeeks.org/difference-between-hashmap-and-hashset/