remove duplicate in list using in java code example
Example 1: java remove equal element of a list
public static <T> List<T> removeDuplicates(List<T> list){
Set<T> set = new LinkedHashSet<>(list);
return new ArrayList<T>(set);
}
Example 2: java remove duplicates
public static <T> ArrayList<T> removeDuplicates(ArrayList<T> list){
Set<T> set = new LinkedHashSet<>(list);
return new ArrayList<T>(set);
}