Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

add a value to a list java in java hashmap

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.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #list #java #java #hashmap
ADD COMMENT
Topic
Name
7+9 =