What is Variance?
Variance describes how subtyping relationships transfer to generic types.
Covariance (Output Positions)
If Dog extends Animal, then Producer<Dog> extends Producer<Animal>
Learning Objectives
Lesson Outline
Variance describes how subtyping relationships transfer to generic types.
If Dog extends Animal, then Producer<Dog> extends Producer<Animal>
If Dog extends Animal, then Consumer<Animal> extends Consumer<Dog>
When T appears in both positions, no subtyping relationship: