update map value java code example Example 1: change the value in a hashtable java Click to copymap.replace(key, newValue); Example 2: java hashmap set value Click to copymyMap.put(key, value);