当前位置:网站首页>Take the intersection of two sets

Take the intersection of two sets

2022-07-07 21:20:00 Maple forest [email protected]

 List<Long> departmentUserNos = departmentVOList.stream().map(UserDepartmentVO::getUserNo).collect(toList());
 List<Long> postUserNos = uo.stream().map(UserPostVO::getUserNo).collect(toList());
              
  //  Extract intersection data 
 List<Long> collect = departmentUserNos.stream().filter(postUserNos::contains).collect(toList());

// Take the difference set 
departmentUserNos.removeAll(collect )---> The rest in the set is departmentUserNos Unique 

 Empathy :
postUserNos.removeAll(collect ) ---> The rest in the set is postUserNos Unique 

原网站

版权声明
本文为[Maple forest [email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071812417642.html