package clean;
import java.util.ArrayList;
import java.util.List;
public class Test_ {
public static void main(String[] args) {
//8,10,12
//8,10,12,13,15,18
//8,10
//8,12,13,18
List<Integer> idList1 = new ArrayList<Integer>();
idList1.add(8);
// idList1.add(10);
idList1.add(12);
idList1.add(13);
idList1.add(18);
//8,10,12,13,15,18
//8,10,12
//8,12,13,18
//8,10
List<Integer> idList2 = new ArrayList<Integer>();
idList2.add(8);
idList2.add(10);
// idList2.add(12);
// idList2.add(13);
// idList2.add(15);
// idList2.add(18);
compare(idList1, idList2);
}
public static void compare(List<Integer> idList1,List<Integer> idList2){
int matchCount = 0;
int notmatchCount_list1 = 0;
int notmatchCount_list2 = 0;
long id_list1 = 0;
long id_list2 = 0;
int j = 0;
for(int i = 0; i < idList1.size();i++){
id_list1 = idList1.get(i);
if(j == idList2.size()){
notmatchCount_list1++;
continue;
}
for(; j < idList2.size();j++){
id_list2 = idList2.get(j);
if(id_list1 == id_list2){
matchCount++;
j++;
if(i == idList1.size() - 1){
for(; j < idList2.size();j++){
notmatchCount_list2++;
}
}
break;
}else if(id_list1 < id_list2){
notmatchCount_list1++;
if(i == idList1.size() - 1){
notmatchCount_list2++;
j++;
for(; j < idList2.size();j++){
notmatchCount_list2++;
}
}
break;
}else {
if(j == idList2.size()-1){
notmatchCount_list1++;
}
notmatchCount_list2++;
continue;
}
}
}
System.out.println((matchCount+notmatchCount_list1) == idList1.size());
System.out.println((matchCount+notmatchCount_list2) == idList2.size());
matchCount = 0;
notmatchCount_list1 = 0;
notmatchCount_list2 = 0;
}
}