当前位置:网站首页>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
边栏推荐
- 2年经验总结,告诉你如何做好项目管理
- Tyut Taiyuan University of technology 2022 introduction to software engineering summary
- 阿里云微服务(一)服务注册中心Nacos以及REST Template和Feign Client
- One article to get UDP and TCP high-frequency interview questions!
- 六种集合的遍历方式总结(List Set Map Queue Deque Stack)
- Realization of the code for calculating the mean square error of GPS Height Fitting
- Basic DOS commands
- 错误:排序与角标越界
- Answer to "software testing" exercise: Chapter 1
- 面试必备:聊聊分布式锁的多种实现!
猜你喜欢

arduino+DS18B20温度传感器(蜂鸣器报警)+LCD1602显示(IIC驱动)

String class

Novatel board oem617d configuration step record

Tyut Taiyuan University of technology 2022 "Mao Gai" must be recited

2-year experience summary, tell you how to do a good job in project management

The overseas sales of Xiaomi mobile phones are nearly 140million, which may explain why Xiaomi ov doesn't need Hongmeng

Quickly generate illustrations

Rt-ppp test using rtknavi

Several high-frequency JVM interview questions

学编程的八大电脑操作,总有一款你不会
随机推荐
Record: the solution of MySQL denial of access when CMD starts for the first time
IPv6 experiment
Iterable、Collection、List 的常见方法签名以及含义
TYUT太原理工大学2022软工导论考试题型大纲
Employment of cashier [differential constraint]
Record: I accidentally wrote a recursion next time
【话题终结者】
TYUT太原理工大学2022数据库考试题型大纲
A brief introduction to the database of tyut Taiyuan University of technology in previous years
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
Record: solution of 404 error of servlet accessing database in dynamic web project
Application architecture of large live broadcast platform
View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
MPLS experiment
View UI plus released version 1.3.1 to enhance the experience of typescript
RTKLIB: demo5 b34f. 1 vs b33
System design learning (I) design pastebin com (or Bit.ly)
西安电子科技大学22学年上学期《射频电路基础》试题及答案
Application architecture of large live broadcast platform
Music playback (toggle & playerprefs)