Hi Cathy, here's an excerpt from HashSet API:
add
public boolean add(Object o)Adds the specified element to this set if it is not already present.
Specified by:
add in interface Set
Overrides:
add in class AbstractCollection
Parameters:
o - element to be added to this set.
Returns:
true if the set did not already contain the specified element.
This mechanism doesn't replace the elements if duplicates are detected.