Java_35 Map_形参
package testing;
import java.util.HashMap;
import java.util.Map;
public class Map_形参 {
public static void main(String[] args) {
Map<String, String> map1 = new HashMap<String, String>();
/* map1.put("key11", "value11");
map1.put("key21", "value21"); */
Test(map1);
Map_形参.Test(new HashMap<String, String>());
}
public static void Test(Map<String, String> map)
{
map.put("key1", "value1");
map.put("key2", "value2");
map.put("key3", "value3");
//map.entrySet()返回的是一个Set集合.
System.out.println(map.entrySet());
}
}
执行结果: