Java change or replace map elements

Java change or replace map elements
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>();

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

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

		// change the element in map:
		hashmap1.put(new Integer(2), "Orange");

		System.out.println("Updated Map " + hashmap1);
	}
}
Source:w‮.ww‬lautturi.com

output:

Initial Map {1=Apple, 2=Banana, 3=Mango}

Updated Map {1=Apple, 2=Orange, 3=Mango}
Created Time:2017-09-02 14:20:49  Author:lautturi