List<String> list1 = new ArrayList<String>();
            list1.add("1");
            list1.add("2");
            list1.add("3");
            list1.add("6");
     
            List<String> list2 = new ArrayList<String>();
            list2.add("2");
            list2.add("3");
            list2.add("7");
            list2.add("8");
     
            // 交集
            List<String> intersection = list1.stream().filter(item -> list2.contains(item)).collect(Collectors.toList());
            intersection.parallelStream().forEach(System.out :: println);
     
            // 差集 (list1 - list2)
            List<String> reduce1 = list1.stream().filter(item -> !list2.contains(item)).collect(Collectors.toList());
            reduce1.parallelStream().forEach(System.out :: println);
     
            // 并集
            List<String> listAll = list1.parallelStream().collect(Collectors.toList());
            List<String> listAll2 = list2.parallelStream().collect(Collectors.toList());
            listAll.addAll(listAll2)
            listAll.parallelStream().forEachOrdered(System.out :: println);
     
            // 去重并集
            List<String> listAllDistinct = listAll.stream().distinct().collect(Collectors.toList());
            listAllDistinct.parallelStream().forEachOrdered(System.out :: println);
     
            list1.parallelStream().forEachOrdered(System.out :: println);

 

// 差集  类型不一致
        List<Person> reduce1 = list1.stream().filter(
        		a -> !list2.stream().map(
                b -> b.getAge() + "-" + b.getName()).collect(Collectors.toList())
                .contains(a.getAge() + "-" + a.getName())).collect(Collectors.toList());

        reduce1.parallelStream().forEach(System.out :: println);

        List<Person> reduce2 = list2.stream().filter(
        		a -> !list1.stream().map(
        		b -> b.getAge() + "&" + b.getName()).collect(Collectors.toList()).contains(a.getAge() + "&" + a.getName()))
                .collect(Collectors.toList());
        reduce2.parallelStream().forEach(System.out :: println);



 // List1与 List2的交集  
     // 过滤list1 ,遍历集合list2   
     // anyMatch(Predicate p) 传入一个断言型函数,对流中所有的元素进行判断,只要有一个满足条件返回true,不满足false。 
     // 取出list2中,符合判断条件的元素,返回值为true。将对象保存新集合中。
        List<Person> intersectA = list1.stream().filter(
                       a -> list2.stream().map(
                       Person::getName).anyMatch(
                       name -> Objects.equals(a.getName(), name)))
                       .collect(Collectors.toList());               
        // 遍历List
        intersectA.parallelStream().forEach(System.out :: println);

 // List对象数据去重
        Map<Object, Boolean> map = new HashMap<>();
        List<Person> list8 = list1.stream()
                .filter(i -> map.putIfAbsent(i.getName()+"&"+i.getAge(), Boolean.TRUE) == null).collect(Collectors.toList());