package devmanuals.com; import java.util.*; public class TreeMapDemo { public static void main(String args[]) { TreeMap Tmap = new TreeMap(); Tmap.put("Gyan", "Singh"); Tmap.put("Ankit", "Kumar"); Tmap.put("Arunesh", "Kumar"); Tmap.put("Anand", "Nagar"); Tmap.put("Ram", "Prakash"); Set> set = Tmap.entrySet(); System.out.println("The Entries of the TreeMap are : "); for (Map.Entry TM : set) { System.out.print(TM.getKey() + ": "); System.out.println(TM.getValue()); } } }