当前位置:网站首页>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
边栏推荐
- arduino+水位传感器+led显示+蜂鸣器报警
- 阿里云微服务(二) 分布式服务配置中心以及Nacos的使用场景及实现介绍
- All in one 1405: sum and product of prime numbers
- Sharing ideas of on-chip transplantation based on rtklib source code
- Alibaba cloud microservices (III) sentinel open source flow control fuse degradation component
- TYUT太原理工大学2022数据库大题之数据库操作
- CorelDRAW plug-in -- GMS plug-in development -- Introduction to VBA -- GMS plug-in installation -- Security -- macro Manager -- CDR plug-in (I)
- View UI plus released version 1.3.1 to enhance the experience of typescript
- Error: sorting and subscript out of bounds
- 十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩
猜你喜欢

Redis介绍与使用

Dark chain lock (lca+ difference on tree)

Experience summary of autumn recruitment of state-owned enterprises

阿里云微服务(四) Service Mesh综述以及实例Istio

2022 National Games RE1 baby_ tree

How do architects draw system architecture blueprints?

System design learning (I) design pastebin com (or Bit.ly)

如何保障 MySQL 和 Redis 的数据一致性?

Alibaba cloud microservices (I) service registry Nacos, rest template and feign client

阿里云微服务(一)服务注册中心Nacos以及REST Template和Feign Client
随机推荐
Network layer 7 protocol
Alibaba cloud microservices (III) sentinel open source flow control fuse degradation component
架构师怎样绘制系统架构蓝图?
Fairygui bar subfamily (scroll bar, slider, progress bar)
TYUT太原理工大学2022软工导论简答题
Tyut outline of 2022 database examination of Taiyuan University of Technology
Redis介绍与使用
IPv6 experiment
Record: solution of 404 error of servlet accessing database in dynamic web project
System design learning (III) design Amazon's sales rank by category feature
View UI plus released version 1.2.0 and added image, skeleton and typography components
String class
继承和多态(下)
Dark chain lock (lca+ difference on tree)
XV Function definition and call
The earth revolves around the sun
Share a website to improve your Aesthetics
IPv6 experiment
Code example of MATLAB reading GNSS observation value o file
记录:下一不小心写了个递归