I have the following situation:
public class A {...};
public class B extends A {...};
And I defined a function inside a class C
with the following header:
private void handleABC(final Collection<A>) {...}
but I get the following message when I try to call it passing type B
:
The method handleABC(Collection) in the type C is not applicable for the arguments (Collection).
Should't this work for both A
and B
since I defined the method Collection<A>
and B
extends from A
? What am I doing wrong?