import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; public class MainClass { public static void main(String[] argv) { Map map = new TreeMap(); map.put("key", "value"); map.put("key2", "value2"); map.put("key3", "value3"); SortedMap sortedMap = (SortedMap) map; System.out.println(sortedMap.firstKey()); } }
key