Check out example codes for "TreeMap get() method in java". It will help you in understanding the concepts better.

Code Example 1

map Integer values to String Keys
import java.util.TreeMap;
public class TreeMapGetMethodExample
{
   public static void main(String[] args)
   {
      TreeMap<String, Integer> tm = new TreeMap<String, Integer>();
      tm.put("violet", 69);
      tm.put("indigo", 65);
      tm.put("green", 40);
      tm.put("blue", 95);
      tm.put("orange", 28);
      System.out.println("TreeMap Mappings: " + tm);
      // get the value of "violet"
      System.out.println("Value is: " + tm.get("violet"));
      // get the value of "green"
      System.out.println("Value is: " + tm.get("green"));
   }
}

Code Example 2

import java.util.TreeMap;
public class TreeMapGetMethodExample
{
   public static void main(String[] args)
   {
      TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
      tm.put(69, "violet");
      tm.put(65, "indigo");
      tm.put(40, "green");
      tm.put(95, "blue");
      tm.put(28, "orange");
      System.out.println("TreeMap Mappings: " + tm);
      // get the value of 69
      System.out.println("Value is: " + tm.get(69));
      // get the value of 95
      System.out.println("Value is: " + tm.get(95));
   }
}

Learn ReactJs, React Native from akashmittal.com