I am trying to create a multimap as follows:
Multimap<String, ? extends A> order = LinkedListMultimap.create();
B b = new B();
order.put("key", b); // shows error
where B
is
class B extends A {}
The error is as follows:
The method
put(String, capture#2-of ? extends A)
in the typeMultimap<String,capture#2-of ? extends A>
is not applicable for the arguments(String, B)
.
I should be able to add a B
since B
extends A
. But I am not able to.