new hashmap java
Map<String, String> myMap = new HashMap<String, String>() {{
        put("a", "b");
        put("c", "d");
    }};
                                
                            new hashmap java
Map<String, String> myMap = new HashMap<String, String>() {{
        put("a", "b");
        put("c", "d");
    }};
                                
                            java hashmap syntax
// Import the HashMap class
import java.util.HashMap;
	// First Example
    // Create a HashMap object called capitalCities
    HashMap<String, String> capitalCities = new HashMap<String, String>();
    // Add keys and values (Country, City)
    	capitalCities.put("England", "London");
    	capitalCities.put("Germany", "Berlin");
    	capitalCities.put("Norway", "Oslo");
    	capitalCities.put("USA", "Washington DC");
    	System.out.println(capitalCities);
	//Second Example
	// Create a HashMap object called stGrade
	Map<String, Integer> stGrade = new HashMap<String, Integer>(); 
	// Insert elements 
       	stGrade.put("aaron", new Integer(90)); 
       	stGrade.put("isaac", new Integer(100)); 
       	stGrade.put("john", new Integer(35)); 
       	stGrade.put("mohammad", new Integer(100)); 
	// Get value
	   	stGrade.get("mohammad"); 	// returns 100
		stGrade.get("aaron"); 		// returns 90
		stGrade.get("john");	 	// returns 35
		stGrade.get("isaac"); 		// returns 100
                                
                            Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us