package demo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class tofindDiff1 {
public static List<Integer> finddiff(List list, List list1){
List arrList = new ArrayList();
for(int i = 0; i < list.size(); i++) {
int o = 0;
String str = list.get(i).toString();
for(int j = 0; j < list1.size(); j++) {
String str1 = list1.get(j).toString();
if(str.equals(str1)){
o=o+1;
}
}
if(o == 0){
arrList.add(str);
}
}
return arrList;
}
public static void main(String[] args) {
int data[]= {12, 2, 4, 545, 11, 32, 13131, 4444};
int data1[]= {12, 2 , 22, 4, 545, 11, 32, 13131, 44441,313,0};
List<Integer> list3 = Arrays.asList(12, 2, 4, 545, 11, 32, 13131, 4444);
List<Integer> list4 = Arrays.asList(12, 2 , 22, 4, 545, 11, 32, 13131, 44441,313,0);
List li= finddiff(list3,list4);
List li2= finddiff(list4,list3);
System.out.println(li);
li.addAll(li2);
System.out.println(li);
System.out.println(li2);
List<Integer> list=new ArrayList<Integer>();
for(int i = 0; i < data.length-1; i++) {
int o = 0;
int str =data[i];
// System.out.println(str);
for(int j = 0; j < data1.length-1; j++) {
if(str==data1[j]){
o=o+1;
}
}
if(o == 0){
list.add(str);
}
}
// System.out.println(list);
}
}