import java.util.*;
public class HashMapDemo
{
public static void main(String args[])
{
//creates HashMap
HashMap<Integer, String> hm = new HashMap<Integer, String>();
System.out.println("Initial size of HashMap: "+hm.size());
//add the element
hm.put(01, "Black");
hm.put(10, "White");
hm.put(11, "Smith");
hm.put(new Integer(05),"Johns" );
hm.put(new Integer(40), "Tom");
Set set = hm.keySet();
System.out.println("HashMap element after adding:");
Iterator itr = set.iterator();
while(itr.hasNext())
{
Object key = itr.next();
Object value = hm.get(key);
System.out.println(key+": "+value);
}
System.out.println("Size of HashMap after add: "+hm.size());
System.out.println("HashMap is Empty: "+hm.isEmpty());
System.out.println("HashMap elements after delete:");
//delete the element
hm.remove(11);
Set set1 = hm.keySet();
Iterator itr1 = set1.iterator();
while(itr1.hasNext()){
Object key = itr1.next();
Object value = hm.get(key);
System.out.println(key+": "+value);
}
System.out.println("Size of HashMap after deletion: "+hm.size());
}