for (int n < ArrayList.length; ...) {  
  for (int i < ArrayList[n].size() ....) {
     yourHashMap.put(yourKey, get(int index));
  }
}  

解决方案 »

  1.   

    使用put方法会自动在hashmap中新增一个元素的吗?
      

  2.   

    当然你得指定一个key值,我那里写了yourKey的地方。
    随便什么东西,只要不是基本类型。要不就搞个Integer吧,累加就行了。
      

  3.   

    谢谢,我想知道的是your key是hashmap中已有的key,还是我指定一个字符串(我想用字符串做key)后,key和value一起插入hashmap.java的帮助中以下这句话应怎样理解?
    Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced. 
    是说将两个相联系的value和key插入到一个hashmap中,还是让一个值与原来hashmap中已有的key相关联?可以解释一下吗?
      

  4.   

    your key 就是你指定的key了
      

  5.   

    那句话是:
    将特定的value与key关联起来,如果map里面已经有这个key,那么原来key所对应的value将会被替换!