Is List a subclass of List? Why are Java generics not implicitly polymorphic?
I’m a bit confused about how Java generics handle inheritance / polymorphism. Assume the following hierarchy – Animal (Parent) Dog – Cat (Children) So suppose I have a method doSomething(List<Animal> animals). By all the rules of inheritance and polymorphism, I would assume that a List<Dog> is a List<Animal> and a List<Cat> is a List<Animal> – … Read more