Type parameter names
Here, in the declaration of the List[+T]
type constructor (we can use the names parameterized types or type constructors interchangeably), we used the parameter name, T
, it's a convention to use such names in generic programming. The names T
,A
,B
, or C
have nothing to do with the initializer type you're going to provide when you initiate a list instance. For example, when you give a String
type for the previously mentioned type parameter when you instantiate List[String]
, it really doesn't matter if the declaration has List[T]
or List[A]
. What we mean is the following two declarations are equivalent:
//With type parameter name A sealed abstract class List[+A] extends AbstractSeq[A] //With type parameter name T sealed abstract class List[+T] extends AbstractSeq[T]