This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics and collections

 
Mabetha Chokwe
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any 1 give me the basic concept of Generics and collections
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That topic goes far too deep to put it in a nutshell. But let me try ...

Collections are classes that hold an array of objects for you. They enhance the behavior of traditional Arrays in adding functionality and convenience.

Prior to Java 5, Collections could not be typed. You could stuff any object into a collection, and upon retrieval, you needed to cast it back to the initial object type.
This is error-prone and also cumbersome.
Generics allow you to parameterize your collection and hence make it type safe.

E.g.

 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Mabetha, welcome to javaranch

It is tough to cover those two massive topics that easily. Here are a few resources that can be useful (these are just tutorials I found on google)

http://java.sun.com/docs/books/tutorial/collections/intro/index.html

http://www.javaworld.com/jw-11-1998/jw-11-collections.html

http://www.allappforum.com/java/java_collection_framework.htm


http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html

http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf

You can also buy this book on this topic...
 
Yewint Ko
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mabetha!
You'd better find out some books. There are too much concept you need for Generics and Collection framework .Visit www.freecomputerbooks.com to find some books.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic