当前位置:网站首页>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)

边栏推荐
- JS to achieve the effect of text marquee
- Camera-CreateCaptureSession
- Kotlin learning apply plugin: 'kotlin Android extensions‘
- Li Kou 79 word search
- 【Flink】Flink 批处理模式Map端数据聚合 NormalizedKeySorter
- 等保备案是等保测评吗?两者是什么关系?
- View of MySQL
- XML parsing bean tool class
- Ten important basic principles of software debugging and testing
- Prism framework
猜你喜欢

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

You cannot call Glide. get() in registerComponents(), use the provided Glide instance instead

Dix critères de base importants pour les essais de débogage de logiciels

Oracle技术分享 oracle 19.14升级19.15

ASP. Net core introduction

【MySQL】 MySQL 导出数据库

Detr3d multi 2D picture 3D detection framework

高性能算力中心 — RoCE — Overview

【Flink】Flink Sort-Shuffle写流程简析

YOLOv5改进:更换骨干网(Backbone)
随机推荐
Uni app, the text implementation expands and retracts the full text
169. 多数元素
【Flink】Flink源码分析——批处理模式JobGraph的创建
Slide the menu of uni app custom components left and right and click switch to select and display in the middle
Navicat16 wireless trial
763. dividing alphabetic intervals
三元损失英文版
Open source! Vitae model brushes the world's first again: the new coco human posture estimation model achieves the highest accuracy of 81.1ap
2022.6.20-----leetcode. seven hundred and fifteen
The kotlin project is running normally and the R file cannot be found
How to solve the problem that iterative semi supervised training is difficult to implement in ASR training? RTC dev Meetup
Use soapUI to access the corresponding ESB project
Popupwindow utility class
An error occurred using the connection to database 'on server' 10.28.253.2‘
816. 模糊坐标
MySQL高级部分( 四: 锁机制、SQL优化 )
Oracle technology sharing Oracle 19.14 upgrade 19.15
[Flink] a brief analysis of the writing process of Flink sort shuffle
軟件調試測試的十大重要基本准則
What does virtualization mean? What technologies are included? What is the difference with private cloud?