当前位置:网站首页>Get the difference data of two sets
Get the difference data of two sets
2022-07-28 02:21:00 【ekkcole】
It can be used to remove inconsistent data between the database and the comparison set
public class TestList {
public static void main(String[] args) {
// browser
List<String> list = Arrays.asList( "2", "3", "4", "5");
// database
List<String> list1 = Arrays.asList("1", "2", "4", "5", "7");
List<String> list2 =new ArrayList<>();
List<String> list3 =new ArrayList<>();
// list1 Not found in
list2=list.stream().filter(e -> {
return !list1.contains(e);
}).collect(Collectors.toList());
// list Not found in
list3=list1.stream().filter(e -> {
return !list.contains(e);
}).collect(Collectors.toList());
System.out.println(list2);
System.out.println(list3);
}
}
边栏推荐
- SkyWalking分布式系统应用程序性能监控工具-中
- 清除浮动的原因和六种方法(解决浮动飞起影响父元素和全局的问题)
- Zkrollup learning materials summary
- 一种比读写锁更快的锁,还不赶紧认识一下
- 微信小程序图片根据屏幕比例缩放
- Ceresdao: the world's first decentralized digital asset management protocol based on Dao enabled Web3.0
- 执行 Add-Migration 迁移时报 Build failed.
- Under the new retail format, retail e-commerce RPA helps reshape growth
- Codeworks round 810 (Div. 2) a~c problem solution
- Leetcode hot topic Hot 100 - > 3. longest substring without repeated characters
猜你喜欢

LeetCode 热题 HOT 100 -> 3. 无重复字符的最长子串

重要安排-DX12引擎开发课程后续直播将在B站进行

LeetCode 热题 HOT 100 -> 1.两数之和

LeetCode 热题 HOT 100 -> 2.两数相加

SkyWalking分布式系统应用程序性能监控工具-中

Cloud native enthusiast weekly: the evolution of Prometheus architecture

Traversal and properties of binary trees

Vxe Table/Grid 单元格分组合并

Execute add migration migration and report build failed

MPLS tunnel experiment
随机推荐
Flex开发网页实例web端
Promise from getting started to mastering (Chapter 3: customize (handwriting) promise)
Data output - image annotation and annotation
53:第五章:开发admin管理服务:6:开发【admin管理员退出登录,接口】;(一个点:我们想要修改一个采用了某种编码方式的值时,新的值最好也按照这种编码方式编码后,再去修改;)
Promise from introduction to mastery (Chapter 2 understanding and use of promise)
Promise从入门到精通(第3章 自定义(手写)Promise)
Flex布局—固定定位+流式布局—主轴对齐—侧轴对齐—伸缩比
Leetcode hot topic Hot 100 - > 2. Add two numbers
如何评估研发人员效能?软件工程师报告帮你看见每个人的贡献
组原必备知识点
Understand the "next big trend" in the encryption industry - ventures Dao
Promise从入门到精通(第4章 async 和 await)
Ceresdao: new endorsement of ventures Dao
Talk to ye Yanxiu, an atlassian certification expert: where should Chinese users go when atlassian products enter the post server era?
Go learning 01
SkyWalking分布式系统应用程序性能监控工具-中
LeetCode 热题 HOT 100 -> 3. 无重复字符的最长子串
Ceresdao: the world's first decentralized digital asset management protocol based on Dao enabled Web3.0
【愚公系列】2022年07月 Go教学课程 019-循环结构之for
软件测试面试题:常见的 POST 提交数据方式