java 如何检查一个ArrayList的元素是否都包含在另一个ArrayList中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/808394/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 13:53:24 来源:igfitidea点击:
How to check whether the elements of an ArrayList are all contained in another ArrayList
提问by troyal
How can I easily check to see whether all the elements in one ArrayList are all elements of another ArrayList?
如何轻松检查一个 ArrayList 中的所有元素是否都是另一个 ArrayList 的所有元素?
回答by Dan Lew
boolean isSubset = listA.containsAll(listB);
回答by Uri
There is a containsAll method in all collections.
所有集合中都有一个 containsAll 方法。

