Java tutorial
//package com.java2s; import java.util.LinkedHashMap; import java.util.Map; public class Main { public static <K, V> Map<K, V> join(Map<? extends K, ? extends V> first, Map<? extends K, ? extends V> second, Map<K, V> destination) { destination.putAll(first); destination.putAll(second); return destination; } public static <K, V> Map<K, V> join(Map<? extends K, ? extends V> first, Map<? extends K, ? extends V> second) { return join(first, second, new LinkedHashMap<>()); } }