Check out example codes for "add a value to a list java in java hashmap". It will help you in understanding the concepts better.

Code Example 1

if (map.get(id) == null) { //gets the value for an id)
    map.put(id, new ArrayList<String>()); //no ArrayList assigned, create new ArrayList

map.get(id).add(value); //adds value to list.

Learn ReactJs, React Native from