替换map中已知key的value值

/**
* 替换map中已知key的value值
*/
@Test
public void s() {
Map<String, Object> requestMap = new HashMap();
requestMap.put("password", "avc");
requestMap.put("table_comment", "应收款预警排行榜宽表-按天统计");
for (Map.Entry<String, Object> entry : requestMap.entrySet()) {
if ("password".equals(entry.getKey())) {
requestMap.put("password",entry.getValue()+"加密");
}
}



System.out.println("++++++++++++++++++++++++++++");
for (Map.Entry<String, Object> entry : requestMap.entrySet()) {
System.out.println("key====="+entry.getKey());
System.out.println("value====="+entry.getValue());
System.out.println("---------------");
}
}
上一篇:Java 的进制


下一篇:java-if选择结构