This question may have been asked before in different formats but I just couldn't find an appropriate answer.
Whats the difference between these codes:
FIRST CODE
ArrayList<? super Number> list=new ArrayList<>(Arrays.asList(1));
SECOND CODE
ArrayList<? extends Number> list=new ArrayList<>(Arrays.asList(1));
Both statement compiles . Please justify why the former compiles . It shows Integer extends Number and Integer super Number too.
EDIT::
The answer I was looking forward to is:
new ArrayList(Collection<? extends E>)
hence both of them compile.
In that way this isn't a duplicate question as the referred answer doesn't describe that.