A HashSet is a collection that stores unique elements with no duplicates. Unlike a HashMap, it does not hold key-value pairs. It only stores the elements themselves. Think of it as a HashMap where you only care about the keys.
Internally, Java's HashSet is backed by a HashMap. Each element becomes a key, and the value is a dummy constant. This gives you average time for add, remove, and contains operations, with space.
A HashSet has no indices. You cannot get the "first" or "third" element like you can with a list. You can only ask: does this element exist in the set?