当前位置:网站首页>取两个集合的交集
取两个集合的交集
2022-07-07 18:13:00 【枫林残@】
List<Long> departmentUserNos = departmentVOList.stream().map(UserDepartmentVO::getUserNo).collect(toList());
List<Long> postUserNos = uo.stream().map(UserPostVO::getUserNo).collect(toList());
// 取出交集数据
List<Long> collect = departmentUserNos.stream().filter(postUserNos::contains).collect(toList());
//取差集
departmentUserNos.removeAll(collect )--->集合中剩余的为departmentUserNos独有的
同理:
postUserNos.removeAll(collect ) --->集合中剩余的为postUserNos独有的
边栏推荐
猜你喜欢
随机推荐
Mongodb由浅入深学习
Splicing and splitting of integer ints
Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!
Oracle 存储过程之遍历
力扣674. 最长连续递增序列
力扣 1037.有效的回旋镖
CUDA versions are inconsistent, and errors are reported when compiling apex
[auto.js] automatic script
CSDN语法说明
Opencv learning notes high dynamic range (HDR) imaging
Jenkins 用户权限管理
MIT science and technology review article: AgI hype around Gato and other models may make people ignore the really important issues
一键部署Redis任意版本
[MySQL - Basic] transactions
gorilla官方:golang开websocket client的示例代码
ASP.NET学习& asp‘s one word
力扣 2319. 判断矩阵是否是一个 X 矩阵
Vulnhub's funfox2
Equals method
MRS离线数据分析:通过Flink作业处理OBS数据