List of usage examples for java.util Map put
V put(K key, V value);
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map);//from w w w. j a v a 2 s. c o m }
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map.get("key2")); }
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); map.clear();/*from www. java 2 s .c om*/ System.out.println(map); }
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map.size()); }
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map);/*from w ww. j a va 2 s .c om*/ }
From source file:Freq.java
public static void main(String args[]) { Map m = new TreeMap(); m.put("a Key", "a Value"); m.put("Java2s", "www.java2s.com"); System.out.println(m.size() + " keys detected:"); System.out.println(m);/*from w ww.j a v a 2 s.c om*/ }
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); 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:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); map.put(null, null);//from www. j a va2 s.c o m System.out.println(map); }
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); Map map2 = new HashMap(); map2.put("key2", "value2"); map2.put("key1", "value1"); map2.put("key3", "value3"); System.out.println(map1.equals(map2)); }
From source file:Main.java
public static void main(String[] args) { Map<String, String> map = getMap(); map.put("a", "b"); }