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

setContainsAll

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

Description

Bulk contains check (subset from the other perspective). Returns true if the target set contains every element of the source set.

Returns

Boolean.

Category

ColdFusion Set built-in functions

Function syntax

setContainsAll(targetSet, sourceSet)

Parameters

ParameterDescription
targetSetSet that must contain all required elements.
sourceSetRequired elements.

See also

Example

The following example uses this API in cfscript (syntax: setContainsAll(targetSet, sourceSet)).

<cfscript>
    have = setNew();
    have.add("a");
    have.add("b");
    have.add("c");

    need = setNew();
    need.add("a");
    need.add("b");

    writeOutput(setContainsAll(have, need)); // true
</cfscript>
      

Real-world example

License check: installed modules must contain every module required by the template.

 <cfscript>
    function licensedFor(required any installedFeatures, required any requiredFeatures) {
        return setContainsAll(installedFeatures, requiredFeatures);
    }

    installed = setNew();
    installed.add("CORE");
    installed.add("REPORTS");
    installed.add("API");

    required = setNew();
    required.add("CORE");
    required.add("REPORTS");

    writeOutput(licensedFor(installed, required)); // 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