Java Programming - unchecked conversion
Here is my code:
public Map<String, Map> getStructureMap (String filename)
{
return elementMap.get(filename);
}
I keep getting an unchecked conversion warning. I tried casting the return but then I get an unchecked casting warning. Any body have any ideas?
I should mention elementMap is also of type Map<String, Map>
Thanks.
Message was edited by:
CSAngel
[631 byte] By [
CSAngela] at [2007-11-26 23:24:16]

I should mention elementMap is also of type Map<String, Map>
For your code to make sense and compile without warnings, then, elementMap should be of typeMap<String, Map<String, Map>>(Ignore the extraneous greater-than which the forum put in there.)
I should mention elementMap is also of type
Map<String, Map>
For your code to make sense and compile without
warnings, then, elementMap should be of
typeMap<String, Map<String, Map>>(Ignore
the extraneous greater-than which the forum put in
there.)
Actually, I think it needs to be:
Map<String, Map<String, String>>**** - that still doesn't work.
null
static Map<String, Map<String,Map>> elementMap; // element map need to be Map<String, Map<String,Map>>public static void main(String[] args) {
elementMap = new HashMap<String,Map<String, Map>>();
elementMap.put("Test",new HashMap<String, Map>());
Map result = getMap("Test");
System.out.println(result.toString());
}
private static Map<String,Map> getMap(String key) //<get method need to return a Map<String, Map>
{
return elementMap.get(key);
}
Edit: As Dr. Clap already said in an earlier post.
~Tim