Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java hashmap increase value by 1

import java.util.HashMap;
import java.util.Map;
...
Map<String, Integer> freq = new HashMap<String, Integer>();
...
int count = freq.containsKey(word) ? freq.get(word) : 0;
freq.put(word, count + 1);
 
PREVIOUS NEXT
Tagged: #java #hashmap #increase
ADD COMMENT
Topic
Name
9+8 =