Hello All,
I'm new to Java programming and I have this issue. I have a requirement to search a table for a field name, retrieve the value and then build a HashMap based on that value retrieved from the table...:? Here is the code I think will handle this...
if (results != null) {
String ntwktype = results.getString("NETWORKTYPE");
String newLocations = "the" + ntwktype + "Locations";
System.out.println("Location Name: " + newLocations);
HashMap newLocations = new HashMap();
theLocations.put(ntwktype, newLocations);
populateOneRow(results);
return getInfo(ntwktype,locationId);
}
My issue: The line in bold, newLocations is a String, so naturally i'm getting an error because of the data type conflicts. I want the value of the String as the HashMap name. So, if newLocations = "Kentucy" I want the next line to be
HashMap Kentucky = new HashMap();
I know in UNIX the $ gets you the value of the variable so I'm looking for something like this that works with Strings in JAVA.
Thanks for your help :veryprou:
Ozarka
I'm new to Java programming and I have this issue. I have a requirement to search a table for a field name, retrieve the value and then build a HashMap based on that value retrieved from the table...:? Here is the code I think will handle this...
if (results != null) {
String ntwktype = results.getString("NETWORKTYPE");
String newLocations = "the" + ntwktype + "Locations";
System.out.println("Location Name: " + newLocations);
HashMap newLocations = new HashMap();
theLocations.put(ntwktype, newLocations);
populateOneRow(results);
return getInfo(ntwktype,locationId);
}
My issue: The line in bold, newLocations is a String, so naturally i'm getting an error because of the data type conflicts. I want the value of the String as the HashMap name. So, if newLocations = "Kentucy" I want the next line to be
HashMap Kentucky = new HashMap();
I know in UNIX the $ gets you the value of the variable so I'm looking for something like this that works with Strings in JAVA.
Thanks for your help :veryprou:
Ozarka