how to create a hashmap in java
// Import the HashMap class
import java.util.HashMap;
// 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);HashMap<Integer,String> map=new HashMap<Integer,String>();//key is integer, value is String
Also in Java:
- phoneword converter
- how to make stage dragable in javafx
- java android development find element by id
- java import text file into arraylist
- convert integer array to string array
- java strin to int
- create instance object java
- creating thread in java example
- java script removing first three indexes
- how to iterate list in java selenium
- how to check if rs next is null
- how to make a new arraylist java
- change fragment in android studio
- how to create gravity in java
- java string length validation regex
- funzione random in java
- how to minimize jframe in java
- Java sort Map by values
- list java oracle
- java call another constructor
- even or odd in java
- usaco 2018 january contest
- java sort array descending
- check if a list contains a string java