Is there any way I can modify the HashMap values of a particular key while iterating over it?
A sample program is given below:
public st
If you want to add to the original ArrayList, then iterate through it on your own:
final ArrayList arr = hm.get(1);
final int size = arr.size();
// this will add size number of "hello" strings to ArrayList arr
for(int i = 0; i < size; ++i){
// you don't appear to ever use this value
final String s = arr.get(i);
// do something to arr
arr.add("hello");
}