~/talk

Kotlin variance modifiers and Covariant Object Nothing pattern.

slides:none on file

Explains how Kotlin uses variance to make types safe and practical: concrete examples include List is out (covariant) while MutableList is invariant, function types with parameters as in and results as out, and a practical pattern—empty collections and sentinel values implemented as a single List<Nothing>/object—so one instance is reused. Shows an Either example using out + Nothing, demonstrates Java array ArrayStoreException as a caution, and covers @UnsafeVariance and private exceptions.

AI-written summary · about

  1. 0:00Introduction to variance
  2. 1:54Generic types basics
  3. 3:18Variance modifiers explained
  4. 6:08Covariance in practice
  5. 9:05Contravariance example
  6. 11:16Function type variance
  7. 15:19Covariant Nothing Object
  8. 18:33Empty list optimization
  9. 20:22Task update pattern
  10. 23:38Arrow library example
  11. 27:22Variance limitations
  12. 36:19Exceptions and summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.