I'm just wondering whether it is possible to create for instance a flexible flattenSets method in Apex.
This method should take a list of sets no matter what type, and return a single set.
Example:
public static Set<Object> flattenSets(List<Set<Object>> sets) {
Set<Object> flattenedSet = new Set<Object>();
for(Set<Object> singleSet: sets) {
flattenedSet.addAll(singleSet);
}
return flattenedSet;
}
Set<Object>toSet<SpecificType>and vice versa. The caller would have to basically create aSet<Object>and populate it via iteration, call, then convert the returned Set in the reverse manner. – Phil W Mar 21 '22 at 08:28