当前位置:网站首页>Exercise (1) create a set C1 to store the elements "one", "two", "three"“
Exercise (1) create a set C1 to store the elements "one", "two", "three"“
2022-07-25 23:53:00 【JOJO, baby】
The original title is : * Create a collection c1, Store elements "one","two","three" * Create another collection c2, Store elements "four","five","six" * And then c2 All elements are stored c1 aggregate * Then create the set c3, Store elements "one,five" * Then output the set c1 Whether to include a collection c3 All elements of * And then c1 In the collection "two" Delete before exporting c1 aggregate 、
Source code
public static void main(String[] args) {
// Create a collection c1, Store elements "one","two","three"
Collection<String> c1 =new ArrayList<String>();
c1.add("one");
c1.add("two");
c1.add("three");
// Create another collection c2, Store elements "four","five","six"
Collection<String> c2 =new ArrayList<String>();
c2.add("four");
c2.add("five");
c2.add("six");
// And then c2 All elements are stored c1 aggregate
System.out.println(c2.addAll(c1));
// Then create the set c3, Store elements "one,five"
Collection<String> c3 = new ArrayList<String>();
c3.add("one,five");
// Then output the set c1 Whether to include a collection c3 All elements of
System.out.println(c1.containsAll(c3));
// And then c1 In the collection "two" Delete before exporting c1 aggregate
c1.remove("two");
System.out.println(c1);
}边栏推荐
- numeric学习之iota,accumulate
- Data intensive application system design - Application System Overview
- Leetcode 0135. distribute candy
- Generating random number random learning uniform_ int_ distribution,uniform_ real_ distribution
- [intelligence question] interview intelligence question
- Good news under the epidemic
- firewall 命令简单操作
- redis-扩展数据类型(跳跃表/BitMaps/HyperLogLog/GeoSpatial)
- C language implementation of three chess
- [day.2] Joseph Ring problem, how to use arrays to replace circular linked lists (detailed explanation)
猜你喜欢

Lua脚本编写Wireshark插件解析第三方私有协议

Matchmaker's words

S4/HANA MM & SD EDI基于NAST的集成配置(ORDERS, ORDRSP, DESADV, INVOIC)

Ratio of learning_ add,ratio_ subtract,ratio_ multiply,ratio_ Use of divide

模式之固定与交替顺序执行

Generating random number random learning uniform_ int_ distribution,uniform_ real_ distribution

调用钉钉api报错:机器人发送签名过期;solution:签名生成时间和发送时间请保持在 timestampms 以内

反射之类加载过程

Leetcode 0919. complete binary tree inserter: array representation of complete binary tree

Topsis与熵权法
随机推荐
Reduce method of array
Three board axe! Help you become an excellent software engineer
行为型模式之迭代器模式
About the foundation of fetch
A long detailed explanation of C language operators
Fixed and alternate sequential execution of modes
[Muduo] EventLoop event cycle
JS synchronization and asynchrony
Key and difficult points of C language pointer
firewall 命令简单操作
三板斧!助你成为优秀软件工程师
Anti shake and throttling
获取马蜂窝酒店数据
[Muduo] package EventLoop and thread
Typescript TS basic knowledge and so on
你还在用浏览器自带书签?这款书签插件超赞
Graph traversal DFS, BFS (code explanation)
The late Apple co-founder Steve Jobs was posthumously awarded the U.S. presidential medal of freedom
R language installation tutorial | graphic introduction is super detailed
Bubble sort idea and Implementation