Answers for "treemap keySet"

1

TreeMap keySet() method in java

import java.util.TreeMap;
public class TreeMapKeySetMethodExample
{
   public static void main(String[] args)
   {
      TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
      tm.put(53, "mango");
      tm.put(62, "apple");
      tm.put(29, "grapes");
      tm.put(93, "banana");
      tm.put(98, "watermelon");
      System.out.println("Given TreeMap is: " + tm);
      // use keySet() to get set view of keys
      System.out.println("set is: " + tm.keySet());
   }
}
Posted by: Guest on October-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language