I am trying to learn Java generics. I am not clear when you will use <T extends Foo>
and when you will use <T super Foo>
. What do each one of these things mean about T? Lets say I have <T extends Comparable>
and <T super Comparable>
, what do each of these mean?
I've read several tutorials at sun.com but I'm still lost. Can somebody illustrate with examples?
Comparable
is a generic type, so using it as a raw type in a generic bound will cause misery. It should, at the very "simplest" beComparable<?>
.) – Porphyritic