I have a LinkedHashSet of values of ThisType. ThisType is implementing the interface ThatType.
I ne
I think what you want is to use wildcards.
LinkedHashSet extends ThatType> someFunction(LinkedHashSet extends ThatType> set) {
return set;
}
As has been explained elsewhere LinkedHashSet
is not a subclass of LinkedHashSet
, since LinkedHashSet
can't accept ThatType
objects.
The wildcard in LinkedHashSet extends ThatType>
means a LinkedHastSet
of some class (not sure what) that extends ThatType
.
Though you may want to consider using this:
Set extends ThatType> someFunction(Set extends ThatType> set) {
return set;
}