Map遍历的三种方式
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class Test {
public static void main(String[] args) {
Map<String,Object> map = new HashMap<>();
map.put("a", "this is a");
map.put("b", "this is b");
map.put("c", "this is c");
map.put("d", "this is d");
/* for (Map.Entry<String, Object> entry : map.entrySet()) {
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}*/
/*for (String key : map.keySet()) {
System.out.println(key);
System.out.println(map.get(key));
}*/
/*Iterator<Map.Entry<String,Object>> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}*/
}
}