我想迭代下面的HashMap
。我想从中检索密钥和值。
HashMap<String,List<HashMap<String, List<String >>>> maps = new HashMap<String, List<HashMap<String, List<String>>>>();
答案 0 :(得分:4)
像这样:
HashMap<String,List<HashMap<String, List<String >>>> maps = new HashMap<>();
for (Map.Entry<String, List<HashMap<String, List<String>>>> entry : maps.entrySet()) {
for (HashMap<String, List<String>> map : entry.getValue()) {
for (Map.Entry<String, List<String>> subEntry : map.entrySet()) {
for (String value : subEntry.getValue()) {
System.out.println(value);
}
}
}
}