I have 2 lists of different sizes which belong to the same class Officer which has attributes:
Integer id;
Integer level;
String role;
I want to compare these two lists list1 and list2 so that I can generate two new lists insertLst and deleteList.
Both list 1 and list2 contain unique elements.
insertLst: This list contains items in list1 and not in list2.
deleteList: This list contains items in list2 and not in list1.
I have no idea how this should be done , might be using The org.apache.commons.collections.CollectionUtils API .
Could you suggest me a java code for generating these two lists insertLst and deleteList?