Whatever message this page gives is out now! Go check it out!
set.union(otherSet)| Parameter | Description |
|---|---|
| otherSet | Another Set. |
cfscript (syntax: set.union(otherSet)).
<cfscript>
setA = setNew();
setA.add(1);
setA.add(2);
setA.add(3);
setB = setNew();
setB.add(2);
setB.add(3);
setB.add(4);
unionSet = setA.union(setB);
// Elements: 1, 2, 3, 4 (order depends on set variant)
writeOutput(unionSet.size()); // 4
</cfscript>
<cfscript>
/**
* Effective permissions = role defaults UNION explicit grants.
*/
function effectivePermissions(required any rolePerms, required any explicitGrants) {
return rolePerms.union(explicitGrants);
}
rolePerms = setNew();
rolePerms.add("READ");
rolePerms.add("LIST");
explicit = setNew();
explicit.add("DELETE");
explicit.add("READ"); // duplicate across union
eff = effectivePermissions(rolePerms, explicit);
writeOutput(eff.size()); // 3
</cfscript>