-
How to remove duplicates from List?
-
- HashSet
listToSet = duplicateList.toSet(); - HashSet
listToSet = duplicateList.getSet(); - HashSet
listToSet = new HashSet (duplicateList); - HashSet
listToSet = Collections.convertToSet(duplicateList); - None of these
- HashSet
Correct Option: C
Duplicate elements are allowed in List. Set contains unique objects.