Whatever message this page gives is out now! Go check it out!

isSupersetOf

Last update:
Jun 9, 2026
Returns true if this set contains every element of the other set.

Description

Returns true if this set contains every element of the other set (that is, this set is a superset of other: A ⊇ B). Equivalent perspective: other.isSubsetOf(this).

Returns

Boolean.

Category

ColdFusion Set member methods

Function syntax

set.isSupersetOf(otherSet)

Parameters

ParameterDescription
otherSetPotential subset.

See also

Example

The following example uses this API in cfscript (syntax: set.isSupersetOf(otherSet)).

<cfscript>
    setA = setNew();
    setA.add(1);
    setA.add(2);
    setA.add(3);
    setA.add(4);

    setB = setNew();
    setB.add(2);
    setB.add(3);

    writeOutput(setA.isSupersetOf(setB)); // true
    writeOutput(setB.isSupersetOf(setA)); // false
</cfscript>
      

Real-world example

Admin role permissions must be a superset of moderator permissions.

 <cfscript>
    moderatorPerms = setNew();
    moderatorPerms.add("POST_EDIT");
    moderatorPerms.add("USER_WARN");

    adminPerms = setNew();
    adminPerms.add("POST_EDIT");
    adminPerms.add("USER_WARN");
    adminPerms.add("USER_BAN");
    adminPerms.add("SITE_CONFIG");

    writeOutput(adminPerms.isSupersetOf(moderatorPerms)); // true
</cfscript>
      

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page