A simple solution is to iterate through the map and use put(Key,Value) once for each mapping key and value in the another Map.
Read moreHow can I merge two maps?
Merging two Maps in Java
Read moreWhat is map merge in Java?
Java HashMap merge() The Java HashMap merge() method inserts the specified key/value mapping to the hashmap if the specified key is already not present . If the specified key is already associated with a value, the method replaces the old value with the result of the specified function.
Read more