That is an example of Java Generics. It helps the programmer in compile time type safety (C++ has a similar looking feature 'class templates' but both are entirely different mechanisms).

kind regards,

Jos

02-14-2010, 04:44 AM

Singing Boyo

Well, aside from the typical less than (<) and greater than(>) operations, it is generics. A generic argument is used to create classes that provide functionality for any objects or for any objects derived from a specific type. They are similar to C++ class templates, but while C++ creates completely separate classes for each generic/template argument used, Java does not - which means that you cannot create arrays of the generic argument, or cast anything to the generic argument type.

Generics is the ability to have lists (/maps/sets etc) of something. You use a line like the one to posted to declare and create them. And the compiler will complain if you try and use a member of the list as anything but a reference to a Book instance.