Was having a interesting issue on Generic which i thought i was pretty familiar with.
Basically i need to pass a
Map<String, List<SubClass>()>
to a
Map<String, List<SuperClass>()>
I was thinking i could just do
Map<String, List<? extends SuperClass>()>
in the method signature, then i should be fine. But i get compiler error complaining type not compatible.
It turns out that the Map i pass in is actually a
HashMap<String, ArrayList<SubClass>()>
where the ArrayList is not the same type as List.
To fix this, i need to make the signature:
Map<String, ? extends List<? extends SuperClass>()>
Advertisements