对多个map进⾏遍历并取值如果你只想输出⾃⼰想要的值不把取出的值放在另⼀个List⾥⾯可以不⽤list.add(),可以直接输出打印⾃⼰想要的值.例⼀(不同类型的map遍历取值):
import java.util.*;
import Matcher;
import Pattern;
public class ceshi {
public static void main(String[] args) {
List<String> list = new ArrayList<>();
Map<String, Integer> map1 = new HashMap<>();
map1.put("this is 1", 1);
Map<String, Character> map2 = new HashMap<>();我在线上
map2.put("this is a", 'a');
Set<Map.Entry<String, Integer>> entries = Set();
填充层
for (Map.Entry<String, Integer> entry:entries) {
Set<Map.Entry<String, Character>> entries1 = Set();
for (Map.Entry<String, Character> entry1 :entries1){
list.Key()+"|"+Key());
list.Key()+"|"+ Value());
list.Value()+"|"+Key());
list.Value()+"|"+Key());//把取出的值放在⼀个集合⾥⾯,取的值可以根据⾃⼰的需要,要key取key,要value取value. }
}
String a = "";
for (String o : list){
a = o;
System.out.println(a);
}
}
}
例⼆(对相同类型的map遍历取值):
import java.util.*;
相似联想public class CeShi1 {
public static void main(String[] args) {
List<String> list = new ArrayList<>();
HashMap<String, Integer> map = new HashMap<>();
map.put("张三",20);
map.put("李四",22);
膝关节炎注意事项哇怎么组词HashMap<String, Integer> map1 = new HashMap<>();
map1.put("王五",21);
map1.put("赵六",23);
的习俗HashMap<String, HashMap<String, Integer>> mapmax = new HashMap<>();
mapmax.put("基础班",map);
mapmax.put("就业班",map1);
Set<Map.Entry<String, HashMap<String, Integer>>> entries = Set();
for (Map.Entry<String, HashMap<String, Integer>> entry : entries) {
// System.out.Key());
Set<Map.Entry<String, Integer>> entries1 = Value().entrySet();
for (Map.Entry<String, Integer> stringIntegerEntry : entries1) {
list.Key()+"\t"+Key()+" "+Value());
}
}
for (int i = 0; i < list.size(); i++) {
String s = (i);
银行同业业务
System.out.println(s);
}
}
}
>ps金属质感