You can use
val unwanted = list2.toSet
list1.filterNot(unwanted)
to remove all items in list2 (you don’t need knowledge of duplicates in list2).
You can use
val unwanted = list2.toSet
list1.filterNot(unwanted)
to remove all items in list2 (you don’t need knowledge of duplicates in list2).