java list 交集差集

 //list 对象 交集差集
                List<Map> newList = list.stream().filter(one -> {
                    List<Boolean> result = hisList.stream().map(two -> one.toString().equals(two.toString())).collect(Collectors.toList());

                    if (result.indexOf(true) > -1){
                        //为flase 时  是差集    为true时是交集
                        return false;
                    }else{
                        return true;
                    }
                }).collect(Collectors.toList());

  

猜你喜欢

转载自www.cnblogs.com/wcnwcn/p/12598472.html