How do I update
The method put(String, capture#11-of ?) in the type
HashMap is not applicable for the arguments
So problem is related into logic of wildcards. Wildcard means "value type parameter can be anything" so
HashMap<String, ?> is valid but here you're not able to put a String value into it.
HashMap<String, ?> is same as
HashMap<String, ? extends Object> so
? can be any type of class but String cannot be any type of class. This is reason of your error.
You need to make small change:
HashMap<String, ? super String>
Or as suggested @user902383 directly change1 (with same result) it into:
Now it will accept Strings.
1 String class is final (you can't extend from it) - for this reason it's better to use
HashMap<String, String> First approach with
HashMap<String, ? super String> is "useless" since you're not able to extend from String class.