using get in map in java
// Java code to illustrate the get() method
import java.util.*;
public class Map_Demo {
public static void main(String[] args)
{
// Creating an empty Map
Map<Integer, String> map = new HashMap<Integer, String>();
// Mapping string values to int keys
map.put(10, "Geeks");
map.put(15, "4");
map.put(20, "Geeks");
map.put(25, "Welcomes");
map.put(30, "You");
// Displaying the Map
System.out.println("Initial Mappings are: " + map);
// Getting the value of 25
System.out.println("The Value is: " + map.get(25));
// Getting the value of 10
System.out.println("The Value is: " + map.get(10));
}
}
Also in Java:
- java cannot find file path
- validation list empty java
- how to remove spaces from an array in java
- java obtain list string from list object
- java call another constructor
- query java persistence
- java identifiers
- java sort array descending
- convert every character in string to arraylist jva
- how make a final variable in java
- java list all non directory files in the directory
- java random between two strings
- usaco 2018 january contest
- list in java
- check leap year in java
- java string length validation regex
- java run project from command line
- sort array java
- generate all prime number less than n java
- how to create a button in java
- imageview.setbackground
- android elevation not working
- java get size of array
- check if a char is a space java