DEV Community

Kotlin - Generics & Type variance

Sendil Kumar on November 25, 2019

Programming is all about abstractions. Instead of instructing machines with binaries (1 and 0s), we created higher level abstractions. These hig...
Collapse
 
temnur profile image
temnur • Edited

Thanks for post.
Instead of here:

val d: Animal = dogList.getAll() // 💥 Type mismatch

I waited for:

val d: List<Animal> = dogList.getAll() // 💥 Type mismatch
Collapse
 
sendilkumarn profile image
Sendil Kumar

oops you are correct, I guess I didnt update the code.