Map集合的遍历方法
package it.com.cc.five;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class MapTest {
public static void main(String[] args) {
Map<String,String> map=new HashMap<String,String>();
map.put("成功","失败");
map.put("贫穷","富贵");
map.put("勤奋","学习");
Set<Map.Entry<String,String>> entrySet= map.entrySet();
for (Map.Entry<String,String> me:entrySet){
String key=me.getKey();
String value = me.getValue();
System.out.println(key+","+value);`
}
}
}`