I have sets of objects CustomObjectA, CustomObjectB, CustomObjectC... that I need to pass to a method.
I would like to put them in a Map of type Map< String, Set< sObject > >, but when I try, I get an error:
Incompatible types since an instance of
Set<CustomObjectA>is never an instance ofSet<sObject>.Incompatible types since an instance of
Set<CustomObjectB>is never an instance ofSet<sObject>.
When I change it to lists instead of a sets (using Map<String, List<sObject>>) and lists of my custom objects, I don't encounter the same problem.
Why would that occur?