import java.util.*;
public class TreeMapDemo
{
public static void main(String args[])
{
TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
System.out.println("Initial size of TreeMap: "+tm.size());
tm.put(2, "Green");
tm.put(5, "Red");
tm.put(3, "Black");
tm.put(1, "White");
tm.put(new Integer(7), "Orange");
// tm.put(08,null); NullPointerException
Set set = tm.entrySet();
Iterator i = set.iterator();
//Retriving the elemnt
while(i.hasNext())
{
Map.Entry me = (Map.Entry)i.next();
System.out.print(me.getKey() + ": ");
System.out.println(me.getValue());
}
System.out.println ("Size after addtion: "+tm.size());
tm.remove(3);
System.out.println ("Size after deletion: "+tm.size());
}
}