Whatever message this page gives is out now! Go check it out!
setAddAll(targetSet, sourceSet)| Parameter | Description |
|---|---|
| targetSet | Set to mutate. |
| sourceSet | Elements to add. |
cfscript (syntax: setAddAll(targetSet, sourceSet)).
<cfscript>
a = setNew();
a.add(1);
b = setNew();
b.add(2);
b.add(3);
setAddAll(a, b);
writeOutput(a.size()); // 3
</cfscript>
<cfscript>
function accumulateIds(required any accumulator, required any batch) {
setAddAll(accumulator, batch);
return accumulator;
}
all = setNew();
batch1 = setNew();
batch1.add("id-100");
batch1.add("id-200");
batch2 = setNew();
batch2.add("id-200"); // duplicate across batches
batch2.add("id-300");
accumulateIds(all, batch1);
accumulateIds(all, batch2);
writeOutput(all.size()); // 3
</cfscript>