New feature of Java 1.5 which allows abstraction over types. Syntactically similar to templates in CeePlusPlus but quite different in semantics. They're similar in that they both use that horrid angle-bracket syntax that makes it easy to confuse nested template declarations with a right-shift, if you don't put a space between the closing brackets... ''What syntax would you have preferred?'' Umm, Java corrects the angle bracket problem. You can write >> or >>> without spaces in a generic, and not have it interpreted as a right shift. ---- Unfortunately, JavaGenerics are too complex for the value they provide. The primary problem is TypeErasure; a generic class in Java represents a single type, regardless of the parameters. That is, Foo and Foo are the same type. This makes it impossible to use generics to implement JamesCoplien's CuriouslyRecurringTemplate idiom, for example. Despite their name, JavaGenerics do not support GenericProgramming. JavaGenerics are basically worthless except as a means of eliminating the need to do some casting when using collections. ---- Links: * Tutorial: http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf * Simple quiz: http://www.grayman.de/quiz/java-generics-en.quiz See also GenericJava. ---- CategoryJava