当前位置:网站首页>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
边栏推荐
- 用栈实现队列
- Realization of the code for calculating the mean square error of GPS Height Fitting
- [GNSS] robust estimation (robust estimation) principle and program implementation
- 【快趁你舍友打游戏,来看道题吧】
- 2年经验总结,告诉你如何做好项目管理
- 121道分布式面试题和答案
- [dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity
- Error: sorting and subscript out of bounds
- 165. Compare version number - string
- 凡人修仙学指针-2
猜你喜欢

阿里云微服务(一)服务注册中心Nacos以及REST Template和Feign Client

One article to get UDP and TCP high-frequency interview questions!

Rt-ppp test using rtknavi

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

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

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

Smart classroom solution and mobile teaching concept description

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

MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series

TYUT太原理工大学2022“mao gai”必背
随机推荐
一文搞定 UDP 和 TCP 高频面试题!
Record: Navicat premium can't connect to MySQL for the first time
All in one 1405: sum and product of prime numbers
MySQL backup -- common errors in xtrabackup backup
String class
Several high-frequency JVM interview questions
2年经验总结,告诉你如何做好项目管理
错误: 找不到符号
4.30 dynamic memory allocation notes
Tyut Taiyuan University of technology 2022 introduction to software engineering
系统设计学习(二)Design a key-value cache to save the results of the most recent web server queries
记录:动态Web项目servlet访问数据库404错误之解决
Interview Essentials: talk about the various implementations of distributed locks!
CorelDRAW plug-in -- GMS plug-in development -- Introduction to VBA -- GMS plug-in installation -- Security -- macro Manager -- CDR plug-in (I)
Error: sorting and subscript out of bounds
Network layer 7 protocol
Share a website to improve your Aesthetics
Voir ui plus version 1.3.1 pour améliorer l'expérience Typescript
Realization of the code for calculating the mean square error of GPS Height Fitting
国企秋招经验总结