Java8 判断一个集合的元素哪些不在另外一个集合
List dataList = Arrays.asList(data); //集合1 List dataList1 = Arrays.asList(data1); //集合2 List list2 = (List) dataList1.stream().filter(item -> !dataList.contains(item)).collect(Collectors.toList()); System.out.println("数量 :" + list2.size()); list2.forEach(x -> System.out.println(x));