Answers for "lastentry treemap java"

2

TreeMap lastEntry() method in java

import java.util.TreeMap;
public class TreeMapLastEntryMethodExample
{
   public static void main(String[] args)
   {
      TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
      tm.put(96, "mango");
      tm.put(39, "grapes");
      tm.put(56, "pineapple");
      tm.put(93, "apple");
      tm.put(69, "watermelon");
      // get value with greatest key
      System.out.println("Check last entry in given TreeMap: ");
      System.out.println("Value is: "+ tm.lastEntry());
   }
}
Posted by: Guest on October-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language