当前位置:网站首页>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
边栏推荐
- Tyut Taiyuan University of technology 2022 introduction to software engineering summary
- 记录:Navicat Premium初次无法连接数据库MySQL之解决
- Voir ui plus version 1.3.1 pour améliorer l'expérience Typescript
- Summary of multiple choice questions in the 2022 database of tyut Taiyuan University of Technology
- 抽象类和接口
- 2022 National Games RE1 baby_ tree
- Fgui project packaging and Publishing & importing unity & the way to display the UI
- 西安电子科技大学22学年上学期《信号与系统》试题及答案
- Network layer 7 protocol
- 架构师怎样绘制系统架构蓝图?
猜你喜欢
View UI Plus 发布 1.3.0 版本,新增 Space、$ImagePreview 组件
学编程的八大电脑操作,总有一款你不会
RTKLIB: demo5 b34f. 1 vs b33
[GNSS data processing] Helmert variance component estimation analysis and code implementation
Differences and application scenarios between MySQL index clock B-tree, b+tree and hash indexes
System design learning (III) design Amazon's sales rank by category feature
Introduction and use of redis
西安电子科技大学22学年上学期《射频电路基础》试题及答案
10 minutes pour maîtriser complètement la rupture du cache, la pénétration du cache, l'avalanche du cache
Inheritance and polymorphism (Part 2)
随机推荐
系统设计学习(一)Design Pastebin.com (or Bit.ly)
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
12 excel charts and arrays
How do architects draw system architecture blueprints?
FileInputStream和BufferedInputStream的比较
Rt-ppp test using rtknavi
Ten minutes to thoroughly master cache breakdown, cache penetration, cache avalanche
Heap sort [handwritten small root heap]
Conceptual model design of the 2022 database of tyut Taiyuan University of Technology
E-R graph to relational model of the 2022 database of tyut Taiyuan University of Technology
How to ensure data consistency between MySQL and redis?
[GNSS] robust estimation (robust estimation) principle and program implementation
MySQL 三万字精华总结 + 面试100 问,吊打面试官绰绰有余(收藏系列
Record: I accidentally wrote a recursion next time
初识C语言(下)
错误:排序与角标越界
Sharing ideas of on-chip transplantation based on rtklib source code
学编程的八大电脑操作,总有一款你不会
TYUT太原理工大学2022数据库题库选择题总结
Alibaba cloud microservices (IV) service mesh overview and instance istio