Java tutorial
//package com.java2s; import java.util.EnumMap; import java.util.Map; public class Main { public static <K extends Enum<K>, V> EnumMap<K, V> createEnumMap(Class<K> keyType) { if (keyType == null) { return null; } return new EnumMap<K, V>(keyType); } public static <K extends Enum<K>, V> EnumMap<K, V> createEnumMap(Map<K, ? extends V> map) { if (map == null) { return null; } return new EnumMap<K, V>(map); } }