I have some problem with generics and collection. Java support generics only at compilation level. So we can't use case B.
{
foo(new HashSet<I>()); //case A
foo(new HashSet<C>()); //case B: wrong
}
void foo(Set<I> set){}
class C implements I{}
interface I {}
So how we can use function foo with Set< C > parameter?
Thanks.