2 Class templates

A class template is a class that can have one or more parametrized types. As strange as it sounds, this concept is exceptionally useful. Note that the concept of templates is not available in Java.

This concept is useful in many cases. However, it is particularly useful for classes that are containers.

To illustrate the usefulness of template classes, let us use linked lists as a basic data structure.

 2.1 Linked list with no template
 2.2 Parametrize the payload type