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