Omni Muss wrote:I just want to confirm I understand <? super B> correctly.
Am I right to assume that List<? super B> ONLY make sense to use when you want to add elements to that List which are of type B or a class that extends B?
No, that's wrong. List<? super B> means you have a List whose elements are of some class X which is a
superclass of B. Not a class which extends B, that would be a
subclass of B. And remember that B is classified as a superclass of B when you're talking about generic wildcards.
Edit:
As for adding elements to such a list, remember that the compiler doesn't know anything about the class X except that it's a superclass of B. So you can add an object to the list provided that it's a X, i.e. it's any object which is a subclass of X. In the example we know that B is a subclass of X, so we can add a B element to the list. Likewise if C is a subclass of B then it's a subclass of X, so we can add a C element to the list.