Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.EnumMap;
import java.util.Map;

public class Main {
    public static <K extends Enum<K>, V> EnumMap<K, V> newEnumMap(Class<K> type, Map.Entry<K, V>... entries) {

        EnumMap<K, V> map = new EnumMap<K, V>(type);

        for (Map.Entry<K, V> entry : entries) {
            map.put(entry.getKey(), entry.getValue());
        }
        return map;
    }
}