I have two array lists listA and listB which may or may not contain same elements. For Example:
listA= [1,2,3] &
listB=[2,3,4]
I need to compare the two array lists and add the element which is present in listA and not in listB to listB. Also if any other element which is present in listB is not there in listA, I should delete it from listB.
Please help me how to code for this in Java.
I prefer using Iterator method if needed.