Java 遍历Map网上的示例很多,这里只给两个,自行参悟。

Map<String, String> params = new HashMap<>();
Map<String, String> customInfo = new HashMap<>();
customInfo.put("a", "1");
customInfo.put("b", "1");
customInfo.put("c", "1");
for (Map.Entry<String, String> entry : customInfo.entrySet()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
params.put("d", "4");
params.put("e", JsonUitls.toJson(customInfo));
for (String paramName : params.keySet()) {
System.out.println(aramName+":"+params.get(paramName));
}


Related Posts: Java 遍历Map示例 :

留言