Answers for "java list without duplicates"

1

java remove duplicates

public static <T> ArrayList<T> removeDuplicates(ArrayList<T> list){
  Set<T> set = new LinkedHashSet<>(list);
  return new ArrayList<T>(set);
}
Posted by: Guest on June-16-2020
0

compare two lists and remove duplicates java

listA.removeAll(new HashSet(listB));
Posted by: Guest on February-21-2020
0

remove duplicates from list java

ArrayList<Object> withDuplicateValues;
 HashSet<Object> withUniqueValue = new HashSet<>(withDuplicateValues);
 
 withDuplicateValues.clear();
 withDuplicateValues.addAll(withUniqueValue);
Posted by: Guest on May-17-2021

Code answers related to "java list without duplicates"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language