Hi All,
a silly doubt, in the javadocs of Java 1.5 , when talking about
generics they have given E, T and V inside <>'s, like "List<E>" and
"<T> T[] toArray(T[] a) ".
What is the difference between them ie E, T and V ?
Thanks
Chanchal
Fred - 02 Dec 2005 06:55 GMT
There is no syntactical difference. The different letters are used as
hints to the types they represent. In the examples you mention:
* E - stands for "Element"
* T - stands for "Type"
* V - stands for "Value" (I'm guessing you saw this in a Map<K,V>,
where K stands for "Key")
It's a naming convention, is all it is.
Check out the Generics Tutorial if you're interested in reading more
about this:
java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
Roedy Green - 02 Dec 2005 18:52 GMT
>What is the difference between them ie E, T and V ?
see http://mindprod.com/jgloss/generics.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Oliver Wong - 02 Dec 2005 19:53 GMT
> Hi All,
> a silly doubt, in the javadocs of Java 1.5 , when talking about
> generics they have given E, T and V inside <>'s, like "List<E>" and
> "<T> T[] toArray(T[] a) ".
>
> What is the difference between them ie E, T and V ?
They're just names. It's like how you can name a class almost anything
you want, and name variables almost anything you want. By convention generic
type names are one character long and in upper case.
- Oliver