当前位置:网站首页>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
边栏推荐
- C code implementation of robust estimation in rtklib's pntpos function (standard single point positioning spp)
- [while your roommate plays games, let's see a problem]
- 阿里云微服务(三)Sentinel开源流控熔断降级组件
- GNSS positioning accuracy index calculation
- 国企秋招经验总结
- Network layer 7 protocol
- Employment of cashier [differential constraint]
- Ten minutes to thoroughly master cache breakdown, cache penetration, cache avalanche
- View UI plus released version 1.2.0 and added image, skeleton and typography components
- 阿里云微服务(四) Service Mesh综述以及实例Istio
猜你喜欢
随机推荐
Database operation of tyut Taiyuan University of technology 2022 database
IPv6 experiment
十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩
记录:下一不小心写了个递归
arduino+水位传感器+led显示+蜂鸣器报警
Sharing ideas of on-chip transplantation based on rtklib source code
抽象类和接口
RTKLIB: demo5 b34f. 1 vs b33
TYUT太原理工大学2022数据库考试题型大纲
FileInputStream和BufferedInputStream的比较
View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
Tyut outline of 2022 database examination of Taiyuan University of Technology
Inheritance and polymorphism (I)
TYUT太原理工大学2022“mao gai”必背
165. Compare version number - string
TYUT太原理工大学2022数据库之关系代数小题
Inheritance and polymorphism (Part 2)
MySQL 三万字精华总结 + 面试100 问,吊打面试官绰绰有余(收藏系列
西安电子科技大学22学年上学期《基础实验》试题及答案
Several high-frequency JVM interview questions









