I'm creating a class that through which works similar to XPath.
The function works perfectly, the problem is that in this part of the line (HashMap<String, Object>) test.get("test-map");
, the "eclipse" shows the following warning:
Type security: Unchecked cast from Object to HashMap
I believe it is a failure of mine, the way I am working may be wrong.
How can I resolve?
HashMap<String, Object> test = new HashMap<String, Object>();
test.put("test-string", "abc");
boolean isNull = test.get("test-map")==null;
if(isNull==false){
HashMap<String, Object> map1 = (HashMap<String, Object>) test.get("test-map");
System.out.println(map1);
isNull = map1==null;
}
if(isNull){
test.put("test-map", new HashMap<String, Object>());
}
String map2 = (String) test.get("test-string");
System.out.println(map2);