I have an two array lists with multiple values at single index. I am adding the values like below:
ArrayList<String> list1 = new ArrayList<String>();
list1.addAll(Arrays.asList("iFRa1wVJ","Breakfast","7:00am","8:30am"));
list1.addAll(Arrays.asList("JyvmCZhw","Lunch","1:00pm","3:00pm"));
list1.addAll(Arrays.asList("HR6ovPjE","Dinner","7:30pm","9:30pm"));
ArrayList<String> list2 = new ArrayList<String>();
list2.addAll(Arrays.asList("iFRa1wVJ","Breakfast1","9:00am","10:30am"));
list2.addAll(Arrays.asList("JyvmCZhw","Lunch","2:00pm","3:00pm"));
list2.addAll(Arrays.asList("HR6ovPjE","Dinner","8:30pm","9:30pm"));
Expected result is as below:
iFRa1wVJ,Breakfast,7:00am,8:30am --> Breakfast1 is overwriiten as Breakfast from list1
JyvmCZhw,Lunch,1:00pm,3:00pm --> 2:00pm is overwriiten as 1:00pm from list1
HR6ovPjE,Dinner,7:30pm,9:30pm --> 8:30pm is overwriiten as 7:30pm from list1
I need to compare the values of each index and update the second list with the values of first list. How to do the comparisons of the list in each index. Any help will appreciated. Thanks.
android.support.v7.util.DiffUtil: "DiffUtil is a utility class that can calculate the difference between two lists and output a list of update operations that converts the first list into the second one."