extend « cast « Java Data Type Q&A





1. java cast from List to List where B extends A    stackoverflow.com

is this possible? if not, why isn't this possible in Java?

interface B extends A {}
public List<B> getList();
List<A> = getList(); // Type mismatch: cannot convert from List<B> to List<A>
I think the topic ...