*
The moose likes Beginning Java and the fly likes Generic related Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Generic related" Watch "Generic related" New topic
Author

Generic related

Jenson Chew
Ranch Hand

Joined: May 27, 2007
Posts: 55
Hi guys,

Could anyone explain in short, to me, generic to me or point me a link? I find Java tutorial somehow very confusing in certain parts, for example wildcards, and subtype or not subtype etc. I understand the generic and how to use it, but when I reached the aforementioned part, it becomes more and more confusing, gosh..


:: Vision is Power ::
dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
ok,below shown is the link ,which can help you understand generics in java.

http://angelikalanger.com/GenericsFAQ/FAQSections/Fundamentals.html#What%20are%20Java%20generics?


http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html
Jenson Chew
Ranch Hand

Joined: May 27, 2007
Posts: 55
Originally posted by dhwani mathur:
ok,below shown is the link ,which can help you understand generics in java.

http://angelikalanger.com/GenericsFAQ/FAQSections/Fundamentals.html#What%20are%20Java%20generics?


http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html


Hi dhwani,

I think I'll follow the first link, since the second link point to Java tutorial which is where I learn about Generic and get me confused

Thanks.

Regards,
Jenson
Jenson Chew
Ranch Hand

Joined: May 27, 2007
Posts: 55
uh, still quite blur and confused after reading through topics on Generic. Need clear and simple explanation or elaboration on what is Generic, when and how to use it.

Would appreciate if anyone can help me on that
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14116
    
  16

Have you tried searching with Google? Search for "java generics tutorial", for example.

This one looks pretty good: Introduction to Java Generics.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jenson Chew
Ranch Hand

Joined: May 27, 2007
Posts: 55
Hi Jesper,

Thanks for the reply. Yes I did do Google search, maybe my searching criteria is not good enough to return me with best matching results. However, I did found some site which is useful but again I found them too broad and deep in details for a beginner learning Generic. Sigh. As my favourite quote says, maybe I'm just too dumb, you never know.

Btw, the link given by you is about the brief introduction of what will be covered under that particular chapter in Deitel's Java: How to Program book, well, at least I think so. Hmm.. maybe it's worth getting that book. But I need to get through the Java tutorial first. Btw, there is another choice of preference, I do not know whether to get Java: How to Program or to get Head First Java. Generic is easy to understand when it just started (for me), when it move in to more detailed sections, I'm totally confused and hard to understand the concept or idea behind
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Maybe it would be helpful if you were a little more specific in saying what is confusing you. For example do you understand the difference between:


Or maybe whats confusing you is the generic type definition at the class or interface level, do you understand how you would implement this interface:



Or is it just the method signatures that are giving you problems, Do you understand why the declaration for Collections.sort() is:

If you have specific questions, it will be easier for us to point you to more specific answers.
[ June 13, 2007: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Jenson Chew
Ranch Hand

Joined: May 27, 2007
Posts: 55
Originally posted by Garrett Rowe:
Maybe it would be helpful if you were a little more specific in saying what is confusing you. For example do you understand the difference between:


Or maybe whats confusing you is the generic type definition at the class or interface level, do you understand how you would implement this interface:



Or is it just the method signatures that are giving you problems, Do you understand why the declaration for Collections.sort() is:

If you have specific questions, it will be easier for us to point you to more specific answers.

[ June 13, 2007: Message edited by: Garrett Rowe ]


Hi Garrett,

These 3 parts are some of the areas which I don't really understand. However, I do know about this:



But understand none of the aforementioned codes listed out by you

It would be good to have a general easy to follow tutorial on Generics for me to learn too, I don't mind going through the hassle to re-learn averything on Generics since I don't understand most of them.

Regards,
Jenson
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Generic related