Monthly Archives: November 2019

how to find common elements in arraylists java

You were given two arraylists as below and you have to identify the common elements present in them. ArrayList1: [sleenium99, automation, tutorials, java] ArrayList2: [arraylist, sleenium99, automation, tutorials, collections] Output is: [sleenium99, automation, tutorials] Method 1: We are going to achieve this task with the help of retainAll method present in the ArrayList.

Output:… Read More »