List of usage examples for java.util IdentityHashMap put
public V put(K key, V value)
From source file:Main.java
public static void main(String args[]) { IdentityHashMap<Integer, String> ihmap = new IdentityHashMap<Integer, String>(); ihmap.put(1, "from"); ihmap.put(2, "java2s.com"); ihmap.put(3, "tutorial"); System.out.println("Value of ihmap before: " + ihmap); System.out.println("Size of the map: " + ihmap.size()); }
From source file:Main.java
public static void main(String args[]) { IdentityHashMap<Integer, String> ihmap = new IdentityHashMap<Integer, String>(); ihmap.put(1, "from"); ihmap.put(2, "java2s.com"); ihmap.put(3, "tutorial"); System.out.println("Map values: " + ihmap); System.out.println("Collection view of the map: " + ihmap.values()); }
From source file:Main.java
public static void main(String args[]) { IdentityHashMap<Integer, String> ihmap = new IdentityHashMap<Integer, String>(); ihmap.put(1, "from"); ihmap.put(2, "java2s.com"); ihmap.put(3, "tutorial"); System.out.println("Value of ihmap before: " + ihmap); // remove element at key 2 ihmap.remove(2);//from w w w . j a va2 s. c o m System.out.println("Value of ihmap after remove: " + ihmap); }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "second"); Object v1 = objMap.get(o1); // first Object v2 = objMap.get(o2); // second }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(5); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "second"); Object v1 = objMap.get(o1); // first Object v2 = objMap.get(o2); // second }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "from java2s.com"); Object v1 = objMap.get(o1);/* www.j a v a 2 s . c om*/ System.out.println(v1); Object v2 = objMap.get(o2); System.out.println(v2); System.out.println(objMap.hashCode()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "from java2s.com"); Object v1 = objMap.get(o1);//from www .ja va 2 s . com System.out.println(v1); Object v2 = objMap.get(o2); System.out.println(v2); System.out.println(objMap); }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "from java2s.com"); Object v1 = objMap.get(o1);/*from w w w.j a va2s. c om*/ System.out.println(v1); Object v2 = objMap.get(o2); System.out.println(v2); System.out.println(objMap.isEmpty()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "from java2s.com"); Object v1 = objMap.get(o1);/*from w w w.j a v a 2 s.c o m*/ System.out.println(v1); Object v2 = objMap.get(o2); System.out.println(v2); System.out.println("Value at key '2' is: " + objMap.get(o1)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(); Object o1 = new Integer(123); Object o2 = new Integer(123); objMap.put(o1, "first"); objMap.put(o2, "from java2s.com"); Object v1 = objMap.get(o1);//from ww w . j a v a 2s. c o m System.out.println(v1); Object v2 = objMap.get(o2); System.out.println(v2); boolean isavailable = objMap.containsValue("first"); System.out.println(isavailable); }