// anyMatch():判断stream流中是否有符合匹配规则的元素,有返回true,没有返回false
List<Long> list1= new ArrayList<>();
List<Long> list2= new ArrayList<>();
list1 = list1.stream().filter(m1 ->
list2.stream().anyMatch(m2 ->
m1 == m2)).collect(Collectors.toList());
两stream流嵌套循环
最新推荐文章于 2023-03-06 11:23:07 发布