• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Generic related

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried searching with Google? Search for "java generics tutorial", for example.

This one looks pretty good: Introduction to Java Generics.
 
Jenson Chew
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Jenson Chew
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic