Answers for "get first value in treemap java"

1

TreeMap firstEntry() method in java

import java.util.TreeMap;
public class TreeMapFirstEntryMethodExample
{
   public static void main(String[] args)
   {
      TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
      tm.put(69, "mango");
      tm.put(53, "apple");
      tm.put(26, "orange");
      tm.put(38, "grapes");
      tm.put(50, "banana");
      System.out.println("Checking TreeMap for first entry: ");
      System.out.println("TreeMap firstEntry is: " + tm.firstEntry());
   }
}
Posted by: Guest on October-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language