import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/*** Map 作为参数进行赋值运算*/
public class TestMapParam {
public static void putInfo(String key,String value,Map map){
map.put(key, value);
}
public static void main(String[] args) {
Map map = new HashMap();
for(int idx=100;idx<105;idx++){
putInfo("key_"+String.valueOf(idx), "value_" + String.valueOf(idx), map);
}
Iterator iter = map.keySet().iterator();
while(iter.hasNext()){
String key = iter.next();
System.out.println("key:" + key + " value:" + map.get(key));
}
}
}
/*
key:key_100 value:value_100
key:key_102 value:value_102
key:key_101 value:value_101
key:key_104 value:value_104
key:key_103 value:value_103
*/
阅读(7947) | 评论(0) | 转发(0) |