AI Features

Creating generic classes

We are going to learn how to create a generic class in this lesson.

We'll cover the following...

Generic class syntax

The syntax for a generic class is similar to that of a generic interface:

class ClassName<T1, T2, ...> {
  ...
}

The members of the class can reference the types passed into it.

Generic class example

Let’s implement a generic list class where ...