Online Java Compiler By
JavaTpoint.com
import java.util.*; public class EnumMapValuesExample2 { // create an enum public enum Days { Monday,Tuesday, Wednesday, Thursday }; public static void main(String[] args) { EnumMap
map = new EnumMap
(Days.class); map.put(Days.Monday, "1"); map.put(Days.Tuesday, "2"); map.put(Days.Wednesday, "3"); //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