Java nested wildcard generic won't compile -
I have a problem with nested wildcard in Java Generic
This is a common case:
/ P>
Integer & gt; Set = new hashet & lt; Integer & gt; (); DoSomething (set); }
This standard Java is generic, works fine.
Although the wildcard gets nested, it does not work anymore:
increases the number of public doSomething (map & lt; string, set & lt;? ; Gt; & gt; Map) {} Public Zero Call Dozing () {Map & lt; String, set & lt; Integer & gt; & Gt; Map = new hashmap & lt; String, set & lt; Integer & gt; & Gt; (); DoSomething (map); }
This leads to a compiler error.
I have tried many types of towns and wildcard permutations, but I am unable to do this work. I do not remember this issue before, and I've worked with Generic for years. Am I very tired and something is clear?
The problem is, can be implemented as doSomething
:
Public zero doSomething (map & lt; string, set & lt;? Number & gt; & gt; extended) {set & lt; Float & gt; Set = ...; Map.put ("xyz", set);
} {}
Comments
Post a Comment