当前位置:网站首页>取两个集合的交集
取两个集合的交集
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独有的
边栏推荐
- School 1 of vulnhub
- 浅尝不辄止系列之试试腾讯云的TUIRoom(晚上有约,未完待续...)
- LeetCode_ 7_ five
- Sword finger offer II 013 Sum of two-dimensional submatrix
- Force buckle 599 Minimum index sum of two lists
- YoloV6:YoloV6+Win10---训练自己得数据集
- Cloud 组件发展升级
- Force buckle 989 Integer addition in array form
- Force buckle 2319 Judge whether the matrix is an X matrix
- rk3128投影仪lcd显示四周显示不完整解决
猜你喜欢
[philosophy and practice] the way of program design
使用高斯Redis实现二级索引
AIRIOT助力城市管廊工程,智慧物联守护城市生命线
PHP method of obtaining image information
[MySQL - Basic] transactions
One click deployment of any version of redis
整型int的拼接和拆分
编译器优化那些事儿(4):归纳变量
Splicing and splitting of integer ints
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
随机推荐
怎样用Google APIs和Google的应用系统进行集成(1)—-Google APIs简介
PHP method of obtaining image information
The boundary of Bi: what is bi not suitable for? Master data, Martech? How to expand?
How to implement safety practice in software development stage
力扣 2319. 判断矩阵是否是一个 X 矩阵
rk3128投影仪lcd显示四周显示不完整解决
【mysql篇-基础篇】事务
【STL】vector
Force buckle 2319 Judge whether the matrix is an X matrix
Sword finger offer II 013 Sum of two-dimensional submatrix
MSE API学习
Get webkitformboundary post login
使用高斯Redis实现二级索引
CSDN语法说明
Gorilla official: sample code for golang to open websocket client
Try the tuiroom of Tencent cloud (there is an appointment in the evening, which will be continued...)
一键部署Redis任意版本
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
[solution] package 'XXXX' is not in goroot
Cloud 组件发展升级