I have 2 arraylists of string object.
List sourceList = new ArrayList();
List destinationList = new ArrayList
private int compareLists(List list1, List list2){
Collections.sort(list1);
Collections.sort(list2);
int maxIteration = 0;
if(list1.size() == list2.size() || list1.size() < list2.size()){
maxIteration = list1.size();
} else {
maxIteration = list2.size();
}
for (int index = 0; index < maxIteration; index++) {
int result = list1.get(index).compareTo(list2.get(index));
if (result == 0) {
continue;
} else {
return result;
}
}
return list1.size() - list2.size();
}