In the code below, class Team
is provided with generics,
public class Team<T extends Player>
{
declaring another type League
with generics
public class League<T extends Team>
{
The question: From the following valid code:
League<Team<FootballPlayer>> league = new League<>();
I infer that Team<FootballPlayer>
extends Team
, is that true?
Isn't it the case that any Team<T>
is a subclass of Object
(typically) but not Team
?
>`. You shouldn't even ask yourself if `Team` extends Team. Team is a raw type, and you shouldn't use raw types. They ruin the whole point of generics.
– JB Nizet Jul 02 '17 at 09:40