Signing you in…

Generics: Type Parameters and Constraints

Generics let you write one implementation for many types: Box<T> holds a value of type T. The compiler checks types at compile time; on the JVM type parameters are erased — T is not known at runtime except with reified inline functions. Use upper bounds (T : Comparable<T>) to call methods on T.

Declaring type parameters
Content is available with subscription.
Get full access to all courses on the platform for one year with a single payment.
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.