当前位置:网站首页>获取两个集合相差数据
获取两个集合相差数据
2022-07-28 00:59:00 【ekkcole】
可以用来去除数据库和对比的集合不一致的数据
public class TestList {
public static void main(String[] args) {
// 浏览器
List<String> list = Arrays.asList( "2", "3", "4", "5");
// 数据库
List<String> list1 = Arrays.asList("1", "2", "4", "5", "7");
List<String> list2 =new ArrayList<>();
List<String> list3 =new ArrayList<>();
// list1中没有的
list2=list.stream().filter(e -> {
return !list1.contains(e);
}).collect(Collectors.toList());
// list中没有的
list3=list1.stream().filter(e -> {
return !list.contains(e);
}).collect(Collectors.toList());
System.out.println(list2);
System.out.println(list3);
}
}
边栏推荐
- Unity 保存图片到相册以及权限管理
- The level "trap" of test / development programmers is not a measure of one-dimensional ability
- How to evaluate the effectiveness of R & D personnel? Software Engineer reports help you see everyone's contribution
- 小米网站主页面大模块——小模块+导航(浮动案例)
- 软件测试面试题:请详细介绍一下各种测试类型的含义?
- 一文读懂Plato&nbsp;Farm的ePLATO,以及其高溢价缘由
- Go learn 02 basic knowledge
- Flex development web page instance web side
- Promise from introduction to mastery (Chapter 2 understanding and use of promise)
- 每条你收藏的资讯背后,都离不开TA
猜你喜欢

Common problem types and methods of mathematical univariate differential proof problems in postgraduate entrance examination

智能合约安全——selfdestruct攻击

微信小程序实现动态横向步骤条的两种方式

uniapp 总结篇 (小程序)

Day6 函数和模块的使用

小程序毕设作品之微信校园浴室预约小程序毕业设计成品(3)后台功能

In it, there is a million talent gap, and the salary rises, but it is not capped

54:第五章:开发admin管理服务:7:人脸入库流程;人脸登录流程;浏览器开启视频调试模式(以便能够在本机的不安全域名的情况下,也能去开启摄像头);

云原生爱好者周刊:Prometheus 架构演进之路

Starfish Os X MetaBell战略合作,元宇宙商业生态更进一步
随机推荐
二叉树的遍历和性质
Common problem types and methods of mathematical univariate differential proof problems in postgraduate entrance examination
轻量版项目管理系统
Flex layout learning completed on PC side
Common video resolution
They are all talking about Devops. Do you really understand it?
53:第五章:开发admin管理服务:6:开发【admin管理员退出登录,接口】;(一个点:我们想要修改一个采用了某种编码方式的值时,新的值最好也按照这种编码方式编码后,再去修改;)
四种常见的 POST 提交数据方式
Promise from introduction to mastery (Chapter 2 understanding and use of promise)
小米网站主页面大模块——小模块+导航(浮动案例)
学会这招再也不怕手误让代码崩掉
Appium 点击操作梳理
MySQL高可用和主从同步
The principle and implementation of loss function cross entropy
Principle and implementation of cross entropy
Flex layout - fixed positioning + flow layout - main axis alignment - side axis alignment - expansion ratio
54:第五章:开发admin管理服务:7:人脸入库流程;人脸登录流程;浏览器开启视频调试模式(以便能够在本机的不安全域名的情况下,也能去开启摄像头);
MySQL的pymysql操作
软件测试面试题:你所熟悉的软件测试类型有哪些?
LeetCode 热题 HOT 100 -> 3. 无重复字符的最长子串