treemap tailmap 28k fromkey 29 method in java

Solutions on MaxInterview for treemap tailmap 28k fromkey 29 method in java by the best coders in the world

showing results for - "treemap tailmap 28k fromkey 29 method in java"
Paolo
25 Oct 2020
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}