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