merged Map - Java java.util

Java examples for java.util:Map Operation

Description

merged Map

Demo Code


//package com.java2s;
import java.util.*;

public class Main {
    public static <K, V> Map<K, V> mergedMap(Map<K, ? extends V> base,
            Map<K, ? extends V> overrides) {
        Map<K, V> map = new HashMap<>();
        map.putAll(base);/*from   w ww. j a va 2 s. c om*/
        map.putAll(overrides);
        return map;
    }
}

Related Tutorials