How to subtract two array lists in Java
Posted by Qasim Khan on October 25, 2010
list1.removeAll(list2); will do the job, but it cost you N1*N2 operations .
If you work with big arrays you can improve performance like this:
public <T> List<T> subtract(List<T> list1, List<T> list2) {
List<T> result = new ArrayList<T>();
Set<T> set2 =...
Filed in: Java
0