Iterator it=map.keySet().iterator()
Object key
Object value
while(it.hasNext()){
key=it.next()
value=map.get(key)
System.out.println(key+":"+value)
}
用keySet得到map 键的set集合 然后用这个集合去迭代
for (int i = 1i <= 20 i++) {if(i == 1) Map<String,Object>map1= new HashMap<String, Object>()
if(i == 2) Map<String,Object>map2= new HashMap<String, Object>()
if(i == 3) Map<String,Object>map3= new HashMap<String, Object>()
......
}
实际上,要多少个,直接创建多少个即可,比较无聊的问题》
Map<String,Object>map1= new HashMap<String, Object>()
Map<String,Object>map2= new HashMap<String, Object>()
Map<String,Object>map3= new HashMap<String, Object>()
.......
变量是需要提前声明的,不能自动生成变量!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)