List of usage examples for java.util IdentityHashMap IdentityHashMap
public IdentityHashMap()
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. ja va 2 s . co m System.out.println("Value of ihmap after remove: " + ihmap); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Map objMap = new IdentityHashMap(); 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 args[]) { IdentityHashMap<Integer, String> ihmap1 = new IdentityHashMap<Integer, String>(); IdentityHashMap<Integer, String> ihmap2 = new IdentityHashMap<Integer, String>(); // populate the ihmap1 ihmap1.put(1, "from"); ihmap1.put(2, "java2s.com"); ihmap1.put(3, "tutorial"); System.out.println("Value of ihmap1 before: " + ihmap1); System.out.println("Value of ihmap2 before: " + ihmap2); // put all values from ihmap1 to ihmap2 ihmap2.putAll(ihmap1);/*w ww. ja v a 2 s .com*/ System.out.println("Value of ihmap2 after: " + ihmap2); }
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>(); 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 o m*/ 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 w w w .j a va 2s . c om 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);// www.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(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 ww w . ja v a 2 s. co m*/ System.out.println(v1); Object v2 = objMap.get(o2); System.out.println(v2); boolean isavailable = objMap.containsValue("first"); System.out.println(isavailable); }