public myConstuctor(Map<String, ?> myMap) {
if (myMap.containsKey(MY_KEY)) {
myMap.put(MY_KEY, someObject);
}
someMemberVariable = new someClass(myMap);
}
I am not able to put an object in the map due to the unbounded wildcard. I am not familiar with wildcard. What makes it difficult (for me..) is I am not able to change the constructor's input type (i.e. myMap) but I need to put an object in the map.
Will someone help..? Thanks in advance!
if you believe the type of
someObject
is compatible withmyMap
,