// 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());
Two-stream nested loop
Guess you like
Origin blog.csdn.net/A_234_789/article/details/108417050
Ranking