Java Generics

by Venkat Subramaniam

Related link: http://www.agiledeveloper.com/download.aspx



Generics was introduced in Java 5. The intent of Generics is make your Java code type-safer. While Java is a strongly typed language, it lacks type-safety when it comes to using collections. Do generics deliver what they promised?
I have been giving a talk entitled "Good, bad and ugly of Java Generics." The feedback from this talk encouraged me to write about Generics to reach a broader audience than those I get to meet in person. You can read about it at
http://www.agiledeveloper.com/articles/GenericsInJavaPartI.pdf
http://www.agiledeveloper.com/articles/GenericsInJavaPartII.pdf
http://www.agiledeveloper.com/articles/GenericsInJavaPartIII.pdf


What are your thoughts on generics in Java?


5 Comments

pholser
2005-06-07 13:38:36
Good stuff
You can find an invaluable reference for Java generics here.
cdiggins
2005-06-18 08:26:21
Type safety
Java collections have always been type safe, generics simply enable static type checking. Static type checking is not the same thing as type safety.
VenkatSubramaniam
2005-06-18 09:41:23
Type safety
It all comes to how we define things isn't it?
http://en.wikipedia.org/wiki/Type_safety
http://en.wikipedia.org/wiki/Strong_typing
In the discussion, my focus is on the static type checking promises of generics.
aautio
2005-08-02 08:11:18
Type safety
If your focus (in this discussion) is in the static type checking, then please drop out the talk about type safety.


ClassCastException shows that there exists type safety even in the old collections.

Subbu
2006-09-04 03:11:22
Type Safety and avoids cluttering of code

Generics have introduced type safety into the java collection framework and thereby we can get rid of the infamous ClassCastException.