Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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);
        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;
    }
}