当前位置:网站首页>Judge the same value of two sets 𞓜 different values
Judge the same value of two sets 𞓜 different values
2022-06-26 03:54:00 【Strong wind blows】
Take the same value
// 1 Data one
List<Integer> ces1 = Arrays.asList(2, 3, 454, 5, 3);
// 2 Data two
List<Integer> ces2 = Arrays.asList(2, 3, 43, 5, 32, 12);
// Store results
List list=new ArrayList();
// Create a map aggregate The value of data one treat as k To hold the
HashMap<Object,
Object> map = new HashMap<>();
//3 Traverse the value of test one
for (Integer e :ces1) {
// 4 Deposit in map Collection
map.put(e, 1);
}
//5 Traverse Test data 2 And map Of key compare If there is map Of k With test data 2 Value It will be added to list Collection
for (Integer a:ces2){
if (StringUtils.isNotBlank(Integer.toString(a))&& map.containsKey(a)){
list.add(a);
}
}
System.out.println(list);
}
Different values
Only need to map.containsKey(a) Change it to !map.containsKey(a)

边栏推荐
- 169. 多数元素
- 动态线段树leetcode.715
- 2022.6.25-----leetcode. Sword finger offer 091
- Alibaba cloud function computing service one click to build Z-blog personal blog
- 在出海获客这件事上,数字广告投放之外,广告主还能怎么玩儿?
- [collection of good books] from technology to products
- 2022.6.20-----leetcode. seven hundred and fifteen
- Open camera anomaly analysis (I)
- After Ali failed to start his job in the interview, he was roast by the interviewer in the circle of friends (plug)
- Sqlitestudio download address
猜你喜欢

MySQL高级篇第一章(linux下安装MySQL)【下】

"Renegotiation" agreement

如何解决 Iterative 半监督训练 在 ASR 训练中难以落地的问题丨RTC Dev Meetup

MapReduce执行原理记录

1.基础关

MySQL高级部分( 四: 锁机制、SQL优化 )

Ten important basic principles of software debugging and testing

Uni app, the text implementation expands and retracts the full text

Camera-CreateCaptureSession

Prism framework
随机推荐
2022.6.25-----leetcode.剑指offer.091
Binary search method
. Net core learning journey
QPS的概念和实现
DETR3D 多2d图片3D检测框架
1. foundation closing
Open source! Vitae model brushes the world's first again: the new coco human posture estimation model achieves the highest accuracy of 81.1ap
Andorid hide the title bar of the system
三元损失英文版
Camera-memory内存泄漏分析(二)
Comparison of static methods and variables with instance methods and variables
Uni app Baidu cloud realizes OCR ID card recognition
面了个字节拿25k出来的测试,算是真正见识到了基础的天花板
View of MySQL
使用SOAPUI访问对应的esb工程
How to solve the problem that iterative semi supervised training is difficult to implement in ASR training? RTC dev Meetup
TiFlash 函数下推必知必会丨十分钟成为 TiFlash Contributor
Uni app custom selection date 1 (September 16, 2021)
JS to achieve the effect of text marquee
2022.6.24-----leetcode.515