Wildcards and Subtyping - Oracle Documentation
This document has a diagram shows the relationships between several List classes declared with both upper and lower bounded wildcards. The relationship as depicted in the picture below:
In the right side hierarchy, List<? super Number>
is sub type to List<? super Integer>
. Isn't it confusing?
As far as I interpret, List<? super Number>
can be represented by any List<type>
where type
is either Number
or super class of Number
. Same logic holds true for List<? super Integer>
also. So how can List<? super Number>
be a sub type of List<? super Integer>
?