treemap keyset 28 29 method in java

Solutions on MaxInterview for treemap keyset 28 29 method in java by the best coders in the world

showing results for - "treemap keyset 28 29 method in java"
Alexander
14 May 2019
1import java.util.TreeMap;
2public class TreeMapKeySetMethodExample
3{
4   public static void main(String[] args)
5   {
6      TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
7      tm.put(53, "mango");
8      tm.put(62, "apple");
9      tm.put(29, "grapes");
10      tm.put(93, "banana");
11      tm.put(98, "watermelon");
12      System.out.println("Given TreeMap is: " + tm);
13      // use keySet() to get set view of keys
14      System.out.println("set is: " + tm.keySet());
15   }
16}