Java examples for Collection Framework:TreeMap
Remove all values from TreeMap
import java.util.TreeMap; public class Main { public static void main(String[] args) { TreeMap treeMap = new TreeMap(); // www . j a v a2 s . c o m //add key value pairs to TreeMap treeMap.put("1","One"); treeMap.put("2","Two"); treeMap.put("3","Three"); treeMap.clear(); System.out.println("Total key value pairs in TreeMap are : " + treeMap.size()); } }