edit value of hashmap java code example Example: update value in hashmap java map.replace(key, map.get(key) + 1); //or map.put(key, map.get(key) + 1);