Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Implementation of HashMap Class in Java map

// Java Program to illustrate the Hashmap Class

// Importing required classes
import java.util.*;

// Main class
public class Main {

	// Main driver method
	public static void main(String[] args)
	{

		// Creating an empty HashMap
		Map<String, Integer> hashmap = new HashMap<>();

		// Inserting entries in the Map
		// using put() method
		hashmap.put("Banana", 100);
		hashmap.put("Orange", 200);
		hashmap.put("Mango", 300);
		hashmap.put("Apple", 400);

		// Iterating over Map
		for (Map.Entry<String, Integer> e : hashmap.entrySet())

			// Printing key-value pairs
			System.out.println(e.getKey() + " "+ e.getValue());
	}
}
Comment

PREVIOUS NEXT
Code Example
Java :: java package keyword 
Java :: netbeans how to get string from jcombobox 
Java :: how to switch between two stylesheets in javafx. 
Java :: Java Boolean Literals 
Java :: constraint layout not matching parent in netsted scrollview 
Java :: output of java file in terminal 
Java :: Composite foreign keys as primary key jpa 
Java :: retrofit with api key post 
Java :: java t point c# 
Java :: how to set up basic java workspace 
Java :: open youtube by default in full landscape mode pragmatically 
Java :: lcd initialize arduino 
Java :: Creating strings using the new keyword Java 
Java :: java string replace last 4 characters 
Java :: Switch statement expressions jdk12+ 
Java :: java join if string is empty delimiter not used 
Java :: BasicAWSCredentials 
Java :: tipo map que permite armazenar na mesma chave java 
Java :: Retries Java 
Java :: java.lang.stackoverflowerror null onetomany 
Java :: java overloading 
Java :: Meditation for stress and depression 
Java :: android studio viewpager 
Java :: IMEI DEVISE ANDROID JAVA 
Java :: a java program must have at least one of these: 
Java :: How to pass ArrayList of Objects from one to another activity using Intent in android? 
Java :: 16 kare koku 4 in java 
Java :: tree algorithm example 
Java :: Detect a face using OpenCV in Java 
Java :: material design implement full screen dialog android java 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =