IdentityHashMap put Example
IdentityHashMap class put example. This example shows you how to use put method.
IdentityHashMap class put example. public Object put(Object,Object) Associates the specified value with the specified key in this identity hash map. If the map previously contained a mapping for the key, the old value is replaced.
Here is the code
/**
* @ # Put.java
* A class repersenting use to put method
* of IdentityHashMap class in java.util package
* version 26 May 2008
* author Rose India
*/
import java.util.*;
public class Put {
public static void main(String args[]) {
IdentityHashMap map = new IdentityHashMap();
//Add the mapping into the map
map.put(1, "A");
map.put(2, "A");
map.put(3, "B");
System.out.println("Map " + map);
}
} |
|