I have a scenario, in which, I need to compare with old and new values, which will be 2 different array lists. Also, i need to find the new element or item added in the 2nd array list and print that value. Below is my code snippet.
Use contains method of the collection interface to check whether the value is present in old list, while iterating through new list.
Here, If you have User defined objects in collection then you need to override equals method of the object.