/**
* 简单类型的处理
*/
public static void showSimpleDeal() {
List<String> list1 = new ArrayList<>();
list1.add("1111");
list1.add("2222");
list1.add("3333");
List<String> list2 = new ArrayList<>();
list2.add("3333");
list2.add("4444");
Set<String> list1Set = new HashSet<>(list1);
Set<String> list2Set = new HashSet<>(list2);
// 差集 (list1 - list2)
List<String> reduce1 = list1.stream().filter(item -> !list2Set.contains(item)).collect(Collectors.toList()); System.out.println("---得到差集 reduce1 (list1 - list2)---");
reduce1.parallelStream().forEach(System.out::println);
// 差集 (list2 - list1)
List<String> reduce2 = list2.stream().filter(item -> !list1Set.contains(item)).collect(Collectors.toList()); System.out.println("---得到差集 reduce2 (list2 - list1)---");
reduce2.parallelStream().forEach(System.out::println);
}