The Javadocs for HashMap state for the put method:
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
Hence, the key is not overwritten, only the value.