Chapter 8. Generics
Generics, or generic programming, is a technique whereby functions can be written in terms of types that are not specified when the function is written, and then later used for many different types. Generics is the term used in Java and Kotlin, but other names, such as parametric polymorphism and templates, are used in other languages for similar features.
In this chapter we will cover:
- Type parameterization
- Type bounds and recursive type bounds
- Invariance, covariance and contravariance
- Algebraic data types