I was going through generics in Java and I'm having trouble trying to understand where I would use the following two.
I understand that the first myList
would ensure that the list only contains elements of type Integer
and all it's superclasses. Now I'm trying to figure out where myList2
would fit in here.
List<? super Integer> myList;
List<Class<? super Integer>> myList2;
Edit: It's not a duplicate of the question being linked...since this is clearly regarding the use of ?
vs Class<?
whereas the other question is about super
vs extend