A common use for HashSet is stripping duplicates from a collection. You pass the original list into the HashSet constructor, and duplicates disappear:
ArrayList<String> names = new ArrayList<>(Arrays.asList(
"Alice", "Bob", "Alice", "Carol", "Bob"
));
HashSet<String> unique = new HashSet<>(names);
System.out.println(unique); // [Bob, Alice, Carol]
The resulting set contains only names. If you need the result back as a list, wrap it: new ArrayList<>(unique).
The order in the output is not guaranteed to match the insertion order. If you need to remove duplicates while preserving the order elements first appeared, use a LinkedHashSet instead of a plain HashSet.