Dear forum,
I have some trouble with Java generics I cannot figure out myself.
What I have is a method that takes a Map<String, ? extends Object> as parameter.
Why can't I create an iterator for that map like that:
public static String[] getStrings(final Map<String, ? extends Object> p_tmInput)
{
Iterator<Map.Entry<String, Object>> it = p_tmInput.entrySet().iterator();
...
}
Doing so my compiler says:
Type mismatch: cannot convert from Iterator<Map.Entry<String,capture#3-of ? extends Object>> to Iterator<Map.Entry<String,Object>>
My understanding of bounded wildcards in Java at the moment says that that map contains java.lang.String as keys and any objects deriveing from java.lang.Object.
I would be glad for any hint.
Thanks in advance and best regards,
Sebastian