Hi ! I have defined a HashMap which uses a double type key and another HashMap as value as shown
HashMap<Double, HashMap<Double, String>> HM1 = new HashMap<Double, HashMap<Double, String>>();
Now for each entry of this HashMap I have a reference to a different HashMap; the name of which is derived from the key value of that entry in this HashMap. For example: If my key value in HM1 is 8, then the name of the HashMap to be referenced in "Alpha8". If the key value in HM1 is 6, then the name of the HashMap to be references in "Alpha6". So my syntax in adding these to the HashMap HM1 is HM1.put(8, Alpha8); and HM1.put(6,Alpha6);
My problem:
The key values are pre-defined which I am reading from a text file. Hence, I open the file, write a scanner object to pick each value and put it in a double type variable keyvalue. However, to get the value for this key, I defined a string s1 = "Alpha"+keyvalue.toString();
My main problem is how do I pass this string in my put function. Because if I say HM1.put(keyvalue, s1); it is the equivalent of passing a double key and a string value rather than a double key and the reference to another HashMap. For primitive data types, you may be able to wrap but for a HashMap reference, I'm not sure how to do it.