I have a LinkedHashSet of values of ThisType. ThisType is implementing the interface ThatType.
I ne
You need the wildcard of Set super ThisType>
. Look at following example
public static void main(String[] args) {
Set set=new LinkedHashSet<>();
Set set2=new LinkedHashSet<>();
someFunction(set);
someFunction(set2);
}
static void someFunction(Set super ThisType> set) {
}
class ThisType implements ThatType{
}
interface ThatType{
}