I went through a wildcard section in Java where I am stuck with this code below
static <T> void type(List<? super T> list){
If you call these methods with this code, it gives an error and clear
List<?> unbounded=new ArrayList<Long>();
But if you change the signature of these methods by adding one additional arg argument, like this
static <T> void type(List<? super T> list, T arg){
and name them
List<?> unbounded=new ArrayList<Long>(); Long lng=90L; //! type(unbounded,lng); //:Error here type2(unbounded,lng); //No error in this one now
Why does this behavior just add one extra argument? How does a restricted list accept unlimited simply by adding one xtra arg?
source share