how to filter out duplicate values in a list java code example Example: compare two lists and remove duplicates java listA.removeAll(new HashSet(listB));