Implemented HashSet in order to remove duplicates from the ArrayList.