I have method getMap(String name, Integer value) so inside method i'm creating new HashMap() object, but i want HashMap() object reference name as String name value
Here is my code, i know i should not do like this because name is String type, but just to show
public static void main(String[] args) {
getMap("refMap", 10);
}
public static void getMap(String name, Integer value) {
Map name = new HashMap<>(); // Compile Error duplicate local variable
//Map refMap = new HashMap<>(); i want like this
}
Is this possible?