4

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?

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
Cemo
  • 5,370
  • 10
  • 50
  • 82

2 Answers2

11

You could use this:

List<? extends List<? extends Number>> a;
List<List<Integer>> b;
a = b;
Thomas
  • 87,414
  • 12
  • 119
  • 157
1
List<? extends List<? extends Number>> a = null;
List<List<Integer>> b = null;
a = b;
Matthijs Bierman
  • 1,720
  • 9
  • 14