代码:
Map<String,String> map = new HashMap<>();
map.put("张三","1212");
map.put("王五","jsd");
for(Map.Entry<String,String> set:map.entrySet()){
System.out.println(set);//{张三=1212,王五=js}
System.out.println(set.getKey()+set.getValue());
}
1. Set<Map.Entry<K,V>> entrySet() {
Set<Map.Entry<K,V>> es; return (es = entrySet) == null ? (entrySet = new EntrySet()) : es;
} //返回该类型的set集合:{张三=1212,王五=js}
版权声明:本文为weixin_42550387原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。