java remove duplicates from integer list code example Example: compare two lists and remove duplicates java listA.removeAll(new HashSet(listB));