Check out example codes for "java map example". It will help you in understanding the concepts better.

Code Example 1

Map <Integer, Point2D.Double> hm = new HashMap<Integer, Point2D>();
hm.put(1, new Point2D.Double(50, 50));

Code Example 2

// Java program to demonstrate working of Map interface 
import java.util.*; 
class HashMapDemo 
{ 
   public static void main(String args[]) 
   { 
       Map< String,Integer> hm =  
                        new HashMap< String,Integer>(); 
       hm.put("a", new Integer(100)); 
       hm.put("b", new Integer(200)); 
       hm.put("c", new Integer(300)); 
       hm.put("d", new Integer(400)); 
  
       // Returns Set view      
       Set< Map.Entry< String,Integer> > st = hm.entrySet();    
  
       for (Map.Entry< String,Integer> me:st) 
       { 
           System.out.print(me.getKey()+":"); 
           System.out.println(me.getValue()); 
       } 
   } 
}

Code Example 3

Map< String,Integer> hm =  
                        new HashMap< String,Integer>(); 
       hm.put("a", new Integer(100)); 
       hm.put("b", new Integer(200)); 
       hm.put("c", new Integer(300)); 
       hm.put("d", new Integer(400));

Learn ReactJs, React Native from akashmittal.com