Online Java Compiler By
JavaTpoint.com
import java.util.*; public class EnumMapValuesExample1 { // create an enum public enum Tutorial { Java, CSS, Python, Android, Javascript }; public static void main(String[] args) { EnumMap
map = new EnumMap
(Tutorial.class); map.put(Tutorial.Java, "1"); map.put(Tutorial.CSS, "2"); map.put(Tutorial.Python, "3"); map.put(Tutorial.Android, "4"); //print the map System.out.println("Map: "+map); Collection
values = map.values(); //print the values of the map only System.out.println("Collection: "+values); } }
Output