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;

public class Main {
    public static <K, V> Map<K, V> createMap(K[] keys, V[] values) {
        Map<K, V> m = new HashMap<K, V>();
        for (int i = 0; i < Math.min(keys.length, values.length); i++) {
            m.put(keys[i], values[i]);
        }
        return m;
    }
}