1import java.util.SortedMap;
2import java.util.TreeMap;
3public class TreeMapTailMapMethodExample
4{
5 public static void main(String[] args)
6 {
7 TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
8 SortedMap<Integer, String> sm = new TreeMap<Integer, String>();
9 tm.put(18, "violet");
10 tm.put(12, "red");
11 tm.put(14, "violet");
12 tm.put(16, "green");
13 tm.put(20, "blue");
14 System.out.println("Get tail map of TreeMap: ");
15 sm = tm.tailMap(14);
16 System.out.println("Tail map values are: " + sm);
17 }
18}