0
我知道有很多类似的问题,看起来像我的,但我只是想要求澄清我的目的。比方说,我有2所列出,它看起来像这样:Java迭代2列表搜索
VO vo1 = new VO("This");
VO vo2= new VO("is");
VO vo3= new VO("first");
VO vo4= new VO("list");
List<VO> volist= new ArrayList<>(); // first list
volist.add(vo1);
volist.add(vo2);
volist.add(vo3);
volist.add(vo4);
List<String> str = new ArrayList<>();
str.add("This");
str.add("is");
str.add("first");
是可以循环这2个列表,找出差异(即“名单”中不存在的STR列表)?我应该怎么做?
[Efficiently compute Intersection of two Sets in Java?](http://stackoverflow.com/questions/7574311/efficiently-compute-intersection-of-two-sets-in-java)**不准确,因为你正在使用列表,但它是关闭** – MightyPork
哈哈,这就是为什么我的第一行:)顺便说一句,答案看起来很复杂。 :x –
看起来很复杂,因为它很复杂。如果你不关心效率,你可以使用两个for循环(遍历列表元素),并检查另一个列表是否全部包含它们。 – MightyPork