java hashmap change key if values are equal code example Example: java hashmap set value myMap.put(key, value);