List<? extends Integer>
denotes a list of an unknown type that extends Integer
. Having forgotten at the moment what it Integer
is final
, at run time it may be a list of some subtype MyImaginaryInteger
, in which case you cannot add Integer
10, as this will violate type safety. Therefore, the compiler does not allow adding elements.
, List<? super Integer>
, Integer
. Integer
10 , , , Integer
.
- List<Integer>
.