List of usage examples for java.util HashMap put
public V put(K key, V value)
From source file:MainClass.java
public static void main(String[] a) { HashMap map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); HashMap map2 = (HashMap) map.clone(); System.out.println(map2);//w w w. ja v a 2 s .c om }
From source file:Main.java
public static void main(String[] args) { HashMap<String, int[]> h = new HashMap<String, int[]>(); h.put("PID", new int[] { 1, 2 }); System.out.println(h.get("PID")[0]); System.out.println(h.get("PID")[1]); }
From source file:BoxingGenericsExample.java
public static void main(String args[]) { HashMap<String, Integer> hm = new HashMap<String, Integer>(); hm.put("speed", 20); }
From source file:Main.java
public static void main(String[] a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map.size()); }
From source file:Main.java
public static void main(String[] a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); HashMap map2 = (HashMap) map.clone(); System.out.println(map2);/* w w w .j ava2 s . c o m*/ }
From source file:Main.java
public static void main(String[] a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); map.clear();/*from w w w. j a v a 2s. c om*/ System.out.println(map); }
From source file:Main.java
public static void main(String[] a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map.containsKey("key1")); System.out.println(map.containsValue("value2")); }
From source file:Main.java
public static void main(String[] a) { HashMap<String, String> map = new HashMap<String, String>(10); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map);/*from www . ja v a 2s . co m*/ }
From source file:Main.java
public static void main(String[] args) { HashMap<String, String> hMap = new HashMap<String, String>(); hMap.put("1", "One"); hMap.put("2", "Two"); hMap.put("3", "Three"); System.out.println(hMap.containsValue("Two")); }
From source file:Main.java
public static void main(String[] a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); map.remove("key3"); System.out.println(map);/*from w ww. j a v a2 s .c o m*/ }