Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Changing or Replacing Elements in java map

// Java program to demonstrate
// the working of Map interface

import java.util.*;
class Main {
	public static void main(String args[])
	{

		// Initialization of a Map
		// using Generics
		Map<Integer, String> hashmap1= new HashMap<Integer, String>();

		// Inserting the Elements
		hashmap1.put(1, "Apple");
		hashmap1.put(2, "Banana");
		hashmap1.put(3, "Mango");

		System.out.println("Initial Map " + hashmap1+"
");

		hashmap1.put(new Integer(2), "Orange");

		System.out.println("Updated Map " + hashmap1);
	}
}
Comment

PREVIOUS NEXT
Code Example
Java :: closable resources java 
Java :: convert text type to int java 
Java :: how to find all apps on android device using java 
Java :: merced A class 
Java :: difference between string vs stringbuffer 
Java :: java blocks 
Java :: factorial java recursion 
Java :: java print data and check in android studio 
Java :: change from one java compiler to another in cmd 
Java :: replace string placeholder java 
Java :: antlr TestRig in java program 
Java :: setUndecorated java 
Java :: Filter out any non-printable characters 
Java :: actionevent java swing 
Java :: collapsingtoolbarlayout collapse listener 
Java :: java create a random number 
Java :: open application programelly android studio 
Java :: Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.util.zip.ZipException: invalid code -- missing end-of-block 
Java :: Caused by: java.lang.IllegalStateException: stream has already been operated upon or closed 
Java :: how to get address of object in java 
Java :: jaspersoft masking 
Java :: java reverse nodes with single node 
Java :: jsp form upload image 
Java :: customize the androidx.appcompat.widget.SearchView site:stackoverflow.com 
Java :: custom class level annotation in spring 
Java :: compare list from db and list from request 
Java :: value of for loop i in Jbutton 
Java :: imagebutton get background color programmatically 
Java :: java private access modifier 
Java :: JavaFX font display issue on Mac 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =