There is another much simpler way:
- Iterate over the list, adding each item to a Set.
- Since Set does not allow duplicate items, so the result is a set of unique items.

java exception