I have an object of type HashMap<String, String>. But HashMap.Entry.getValue() still returns object. It does not respect the generics parameters of it's parent HashMap. The same applies to getKey().
Here is the example:
class Main extends HashMap<String, String>
{
public static void main(String[] args)
{
Main m = new Main();
m.put("key", "value");
for (Main.Entry e : m.entrySet())
String s = e.getValue(); // this line throws an error telling that getValue() returns Object and not String
}
}