Check out example codes for "java remove equal element of a list". It will help you in understanding the concepts better.

Code Example 1

public static <T> List<T> removeDuplicates(List<T> list){
  Set<T> set = new LinkedHashSet<>(list);
  return new ArrayList<T>(set);
}

Code Example 2

public static <T> ArrayList<T> removeDuplicates(ArrayList<T> list){
  Set<T> set = new LinkedHashSet<>(list);
  return new ArrayList<T>(set);
}

Learn ReactJs, React Native from akashmittal.com