Start of main content
Talk type: Talk
Type variance in Java and Kotlin
If we compare a program to a building, then program's API is the foundation. It's impossible to underestimate the importance of flexible and convenient APIs for the maintainability of the code. And it's impossible to build such APIs without understanding of how to use type variance in type-parametrized classes and methods.
In this lecture we consider the full evolution of type variance in JVM world, starting from covariant arrays from the very first versions of Java, through Java wildcard types to Kotlin's declaration site and use-site variance. We will move from simple to complex examples to get a steady understanding of how and when to use type variance in your APIs.