List of usage examples for java.util EnumMap put
public V put(K key, V value)
From source file:Tutorial.java
public static void main(String[] args) { Map m = new HashMap<Tutorial, String>(); EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(m); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map.hashCode()); }
From source file:Main.java
public static void main(String[] args) { EnumMap<Size, String> sizeMap = new EnumMap<Size, String>(Size.class); sizeMap.put(Size.S, "S"); sizeMap.put(Size.M, "M"); sizeMap.put(Size.L, "L"); sizeMap.put(Size.XL, "XL"); sizeMap.put(Size.XXL, "XXL"); sizeMap.put(Size.XXXL, "XXXL"); for (Size size : Size.values()) { System.out.println(size + ":" + sizeMap.get(size)); }//from w ww. ja v a2 s. c o m }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map.hashCode()); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map);//w ww . ja v a2 s .c om map.remove(Tutorial.PHP); System.out.println("Updated Map: " + map); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map);/*from w w w.ja v a2 s . co m*/ Set<Map.Entry<Tutorial, String>> set = map.entrySet(); System.out.println("Set: " + set); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map);//from ww w . ja v a2s .c om Collection<String> values = map.values(); System.out.println("Collection:" + values); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map.hashCode()); map.clear();/*w ww . j a v a2 s .c o m*/ System.out.println(map.hashCode()); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map);/*from w w w . j a v a2s . c om*/ map.clear(); System.out.println(map); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map);// ww w. j av a2s . c om // get the value for Tutorial.CSS String value = map.get(Tutorial.CSS); System.out.println("Tutorial.CSS value:" + value); System.out.println("Tutorial.Javascript value:" + map.get(Tutorial.Javascript)); }
From source file:Tutorial.java
public static void main(String[] args) { EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class); map.put(Tutorial.CSS, "1"); map.put(Tutorial.Python, "2"); map.put(Tutorial.PHP, "3"); map.put(Tutorial.Java, "4"); System.out.println(map);/*from www .ja v a 2 s . c om*/ System.out.println("Number of mappings:" + map.size()); map.put(Tutorial.Javascript, "5"); // print the new number of mappings of this map System.out.println("Number of mappings:" + map.size()); }