I have used below program two compare two Array list, But I don't want to miss the condition when both array list are same in size but content different values.Also is below code can be minimize.
ArrayList<String> firstList = new ArrayList<String> ( Arrays.asList("Cake", "pizza", "pasta") );
ArrayList<String> secondList = new ArrayList<String> ( Arrays.asList("Chocolate", "fruits", "pancake"));
if (!firstList.equals(secondList)) {
if (firstList.size() > secondList.size()) {
firstList.removeAll(secondList);
SOP("Differance" + firstList+ "---------Total Number of Group mismatch----------"+ firstList.size());
} else if (firstList.size() < secondList.size()) {
secondList.removeAll(firstList);
SOP("Differance" + secondList+ "---------Total Number of Group mismatch----------" + secondList.size());
}
} else {
SOP("Both are same");
}