Java Map Merge merge(Map mapPriorityLeast, Map mapPriorityFirst)

Here you can find the source of merge(Map mapPriorityLeast, Map mapPriorityFirst)

Description

merge

License

Open Source License

Declaration

public static <T1, T2> Map<T1, T2> merge(Map<T1, T2> mapPriorityLeast, Map<T1, T2> mapPriorityFirst) 

Method Source Code


//package com.java2s;

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static <T1, T2> Map<T1, T2> merge(Map<T1, T2> mapPriorityLeast, Map<T1, T2> mapPriorityFirst) {
        Map<T1, T2> newMap = new HashMap<>();

        for (Map.Entry<T1, T2> entry : mapPriorityLeast.entrySet()) {
            newMap.put(entry.getKey(), entry.getValue());
        }/*w  ww  . j  a v a  2  s. com*/

        // override
        for (Map.Entry<T1, T2> entry : mapPriorityFirst.entrySet()) {
            newMap.put(entry.getKey(), entry.getValue());
        }
        return newMap;
    }
}

Related

  1. merge(Map map, Map... maps)
  2. merge(Map master, Map copy)
  3. merge(Map src, Map dest)
  4. merge(Map first, Map second)
  5. merge(Map map1, Map map2)
  6. mergeAggCompStatsTopoPageSpout(Map accSpoutStats, Map spoutStats)
  7. mergeBootArgumentsIntoMap(String[] args, Map map)
  8. mergeCompactedValue(Map obj, String key, Object value)
  9. mergeCompositions( Map target, Map source)