Confirmed users
596
edits
(→Operators: add and, xor, and reference set theory) |
m (→Operators) |
||
| Line 184: | Line 184: | ||
* Does not preserve order. | * Does not preserve order. | ||
function addColl(coll1, coll2) | function addColl(coll1, coll2) | ||
* Returns a collection that contains all values from coll1 and coll2. | * Returns a collection that contains all values from coll1 and coll2. | ||
* If the same item is in both coll1 and coll2, it will be added twice. | * If the same item is in both coll1 and coll2, it will be added twice. | ||
| Line 193: | Line 193: | ||
* Preserves order | * Preserves order | ||
function addCollWithDups(coll1, coll2) | function addCollWithDups(coll1, coll2) | ||
* Returns a collection that contains all values from collBase, | * Returns a collection that contains all values from collBase, | ||
* apart from those in collSubtract. | * apart from those in collSubtract. | ||
| Line 204: | Line 204: | ||
* Preserves order of collBase. | * Preserves order of collBase. | ||
function subtractColl(collBase, collSubtract) | function subtractColl(collBase, collSubtract) | ||
* Returns a collection that contains all values that are contained | * Returns a collection that contains all values that are contained | ||
* in *both* coll1 and coll1. | * in *both* coll1 and coll1. | ||
| Line 215: | Line 215: | ||
* Does not preserve order. | * Does not preserve order. | ||
function andColl(coll1, coll2) | function andColl(coll1, coll2) | ||
* Returns a collection that contains all values that are contained | * Returns a collection that contains all values that are contained | ||
* only in coll1 or coll2, but *not in both*. | * only in coll1 or coll2, but *not in both*. | ||
| Line 226: | Line 226: | ||
* Does not preserve order. | * Does not preserve order. | ||
function xorColl(coll1, coll2) | function xorColl(coll1, coll2) | ||
* Returns a new collection that is sorted based on the |sortFunc|. | * Returns a new collection that is sorted based on the |sortFunc|. | ||
* | * | ||