Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;

import java.util.Map;
import java.util.Map.Entry;

public class Main {
    public static <K, G> Map<K, G> reverseMap(Map<String, K> keyIdMap, Map<String, G> keyValueMap) {
        Map<K, G> ret = new HashMap<K, G>();
        for (Entry<String, G> entry : keyValueMap.entrySet()) {
            K id = keyIdMap.get(entry.getKey());
            ret.put(id, entry.getValue());
        }
        return ret;
    }
}