1import java.util.TreeMap;
2public class TreeMapSizeMethodExample
3{
4 public static void main(String[] args)
5 {
6 TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
7 tm.put(32, "pineapple");
8 tm.put(51, "watermelon");
9 tm.put(38, "grapes");
10 tm.put(69, "mango");
11 tm.put(58, "apple");
12 System.out.println("Given TreeMap is: " + tm);
13 System.out.println("size of TreeMap is: " + tm.size());
14 }
15}