Simple way to compare 2 ArrayLists

后端 未结 10 1862
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 00:50

I have 2 arraylists of string object.

List sourceList = new ArrayList();
List destinationList = new ArrayList

        
10条回答
  •  半阙折子戏
    2020-11-30 01:24

    The answer is given in @dku-rajkumar post.

    ArrayList commonList = CollectionUtils.retainAll(list1,list2);

提交回复
热议问题