Java type casting generics list of list of child to list of list of parent -


this question has answer here:

i have class childdata1 extends data. how can convert list<list<childdata1>> list<list<data>> ?

under rules of generics can following assignment without cast:

list<list<childdata>> subclasslist = ... list<? extends list<? extends data>> superclasslist = subclasslist; 

Comments