[Solved] how can we add two String arraylist in hashmap and retrive value as match with key name index


I guess, you want to store first list items as keys and second list items as values in a HashMap. For that, you need to create a hashmap of string, string type as given below and store all its value there.

HashMap<String, String> hmap = new HashMap<String, String>();
for(int i=0;i<a1.size();i++){
  hmap.put(a1.get(i),a11.get(i));
}

for(Map.Entry m:hmap.entrySet())
{  
   System.out.println("Key :"+m.getKey()+"Value:"+m.getValue());  

} 

0

solved how can we add two String arraylist in hashmap and retrive value as match with key name index