Java Map Merge merge(Map map1, Map map2)

Here you can find the source of merge(Map map1, Map map2)

Description

merge

License

Open Source License

Declaration

public static <T1, T2, T3> Map<T1, T3> merge(Map<T1, T2> map1, Map<T2, T3> map2) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static <T1, T2, T3> Map<T1, T3> merge(Map<T1, T2> map1, Map<T2, T3> map2) {
        Map<T1, T3> map3 = new HashMap<T1, T3>(map1.size());
        merge(map1, map2, map3);// w  w  w .java 2  s .  c  o  m
        return map3;
    }

    public static <T1, T2, T3> Map<T1, T3> merge(Map<T1, T2> map1, Map<T2, T3> map2, Map<T1, T3> map3) {
        for (Map.Entry<T1, T2> e1 : map1.entrySet()) {
            map3.put(e1.getKey(), map2.get(e1.getValue()));
        }
        return map3;
    }
}

Related

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