如何取出Map中key和value的值
1个回答
展开全部
public static void main(String[] args) {
Map<String, String> map = new HashMap<String, String>();
map.put("1", "v1");
map.put("2", "v2");
for (String key : map.keySet()) {
System.out.println("key= " + key + " and value= " + map.get(key));
}
}
Map<String, String> map = new HashMap<String, String>();
map.put("1", "v1");
map.put("2", "v2");
for (String key : map.keySet()) {
System.out.println("key= " + key + " and value= " + map.get(key));
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询