Categories
Mastering Development

In the absence of mutable types, is there a case for invariant type parameters?

So, by now it is pretty obvious what horrible mistake it was that arrays in Java are covariant. Maybe this design flaw is even the reason why many developers still struggle with the fact that, against common intuition, List<Thread> is not a subtype of List<Runnable>. A lot of this has to do with Lists (and […]