Published
- 1 min read
find comon in two list and do something java
The solution for this is noted below
find comon in two list and do something java
Solution
List<Integer> common = new ArrayList<Integer>(listA);
common.retainAll(listB);
// common now contains only the elements which are contained in listA and listB.
Try other methods by searching on the site. That is if this doesn’t work