MENU

Fun & Interesting

Variance... without Generics!

Dave Leeds 8,969 lượt xem 1 year ago
Video Not Working? Fix It Now

Did you know that you can use covariance and contravariance in Kotlin without generics? Unlock the mental model of generic variance by first understanding how variance works with regular type hierarchies!

✨ New to Kotlin? Start here: https://typealias.com/start/
... or pick up the new Leanpub Edition! https://book.typealias.com/

🚀 I just launched a new email newsletter!
Sign up here: https://newsletter.typealias.com/

00:00 Introduction
00:35 Upholding the Contract in Subtypes
02:05 Covariance
04:12 Contravariance
06:54 Summary of Variance
07:15 Why Generic Variance Works
08:10 Wrap-up

#kotlin #androiddevelopment

Comment