Bounded Wildcards in Java
-
07-12-2019 - |
Question
This is not fine
List<List<? extends Number>> a;
List<List<Integer>> b;
a = b;
This is fine
List<? extends Number> c;
List<Integer> d;
c = d;
How can make it compile first one?
Solution
You could use this:
List<? extends List<? extends Number>> a;
List<List<Integer>> b;
a = b;
OTHER TIPS
List<? extends List<? extends Number>> a = null;
List<List<Integer>> b = null;
a = b;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow