Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

E, T and V in Generics Syntax

Thread view: 
Chanchal - 02 Dec 2005 04:58 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 ?

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.