当前位置:网站首页>List set map queue deque stack
List set map queue deque stack
2022-07-06 13:20:00 【[email protected]】
List
Mode one :for loop
for(int i = 0;i = list.size();i++){
System.out.println(list.get(i));
}Mode two :for each Loop traversal
for(String s : list){
System.out.println(s);
}Mode three :iterator Iterator traversal
Iterator<String> it = list.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
Set
Mode one :for each
for(String s : set){
System.out.println(s);
}Mode two :iterator Iterator traversal
Iterator it = set.iterator();
while(it.hasNext()){
System.out.println(it.next());
}Map
Mode one :for each Traverse Map Of key value
for(String key : map.keySet()){
Integer value = map.get(key);
System.out.println(key + "=' =value);
}Mode two :for each At the same time through key and value
for(Map.Entry<String,Integer> entry : map.entrySet()){
String key = entry.getKey();
Integer value = entry.getValue();
System.out.println(key + "=" + value):
}Queue queue (FIFO)
Mode one : for each Traverse the queue
for(String s : queue){
System.out.println(s);
}Mode two :iterator Iterator traverses queue
String item = null;
while((item = queue.poll()) != null){
System.out.println(item);
}Deque deque
iterator Iterator traversal
String item = null;
while((item = deque.poll.set()) != null){
System.out.println(item);
}Stack Stack (LIFO)
while(!stack.isEmpty()){
System.out.println(stack.poll());
}版权声明
本文为[[email protected] Yummy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060916020059.html
边栏推荐
- 一文搞定 UDP 和 TCP 高频面试题!
- 【话题终结者】
- Tyut Taiyuan University of technology 2022 introduction to software engineering
- View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
- Fgui project packaging and Publishing & importing unity & the way to display the UI
- Tyut outline of 2022 database examination of Taiyuan University of Technology
- Voir ui plus version 1.3.1 pour améliorer l'expérience Typescript
- TYUT太原理工大学往年数据库简述题
- Exception: ioexception:stream closed
- Fairygui bar subfamily (scroll bar, slider, progress bar)
猜你喜欢

十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩

Design a key value cache to save the results of the most recent Web server queries

继承和多态(下)

121 distributed interview questions and answers

Decomposition relation model of the 2022 database of tyut Taiyuan University of Technology

Application architecture of large live broadcast platform
![[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity](/img/9d/7284c1399964d3fb48886f12e4941c.jpg)
[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity

记录:初次cmd启动MySQL拒接访问之解决

Alibaba cloud microservices (III) sentinel open source flow control fuse degradation component

How do architects draw system architecture blueprints?
随机推荐
Answer to "software testing" exercise: Chapter 1
Alibaba cloud microservices (III) sentinel open source flow control fuse degradation component
阿里云微服务(四) Service Mesh综述以及实例Istio
Fgui project packaging and Publishing & importing unity & the way to display the UI
12 excel charts and arrays
Record: solution of 404 error of servlet accessing database in dynamic web project
西安电子科技大学22学年上学期《信号与系统》试题及答案
Novatel board oem617d configuration step record
TYUT太原理工大学2022数据库大题之分解关系模式
Inheritance and polymorphism (Part 2)
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
Employment of cashier [differential constraint]
Pride-pppar source code analysis
Design a key value cache to save the results of the most recent Web server queries
Record: I accidentally wrote a recursion next time
记录:下一不小心写了个递归
Basic DOS commands
初识C语言(上)
TYUT太原理工大学2022数据库大题之数据库操作
(超详细onenet TCP协议接入)arduino+esp8266-01s接入物联网平台,上传实时采集数据/TCP透传(以及lua脚本如何获取和编写)