Software Engineer working at omni:us. Making magic AI black boxes work in production on a daily basis. Emptying shelves of company sweets on a weekly basis.
Contravariance: Why is Consumer<Animal> a subtype of Consumer<Cat>?
This post is the second part of a 3-part series. If you are not familiar with the…
Covariance: Why List<Cat> is not assignable to List<Animal>?
I often find myself trying to assign a lists of cats (List<Cat>) to a list of animals (List<Animal>). This is not possible in java and it led me down a rabbit hole of reading…