Home » JAVA Programming » Data Structures » Question
  1. How to remove duplicates from List?
    1. HashSet listToSet = duplicateList.toSet();
    2. HashSet listToSet = duplicateList.getSet();
    3. HashSet listToSet = new HashSet(duplicateList);
    4. HashSet listToSet = Collections.convertToSet(duplicateList);
    5. None of these
Correct Option: C

Duplicate elements are allowed in List. Set contains unique objects.



Your comments will be displayed only after manual approval.