Confirmed users
596
edits
m (→Operators) |
(→Operators: finished the rename) |
||
| Line 179: | Line 179: | ||
All operators observe the original collections they are constructed from, and adapt the result based on changes, and notify any observers that are registered on the operator result collection. | All operators observe the original collections they are constructed from, and adapt the result based on changes, and notify any observers that are registered on the operator result collection. | ||
* + | * operator + | ||
* 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 only once. | * If the same item is in both coll1 and coll2, it will be added only once. | ||
| Line 189: | Line 189: | ||
* @returns {Collection} | * @returns {Collection} | ||
* Does not preserve order. | * Does not preserve order. | ||
function | function mergeColl(coll1, coll2) | ||
* + | * operator + | ||
* 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 201: | Line 200: | ||
* @returns {Collection} | * @returns {Collection} | ||
* Preserves order | * Preserves order | ||
function | function concatColl(coll1, coll2) | ||
* - | * operator - | ||
* 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 216: | Line 214: | ||
function subtractColl(collBase, collSubtract) | function subtractColl(collBase, collSubtract) | ||
* & | * operator & | ||
* 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 226: | Line 224: | ||
* @returns {Collection} | * @returns {Collection} | ||
* Does not preserve order. | * Does not preserve order. | ||
function | function inCommonColl(coll1, coll2) | ||
* operator xor | |||
* 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 238: | Line 236: | ||
* @returns {Collection} | * @returns {Collection} | ||
* Does not preserve order. | * Does not preserve order. | ||
function | function notInCommonColl(coll1, coll2) | ||
* Returns a new collection that is sorted based on the |sortFunc|. | * Returns a new collection that is sorted based on the |sortFunc|. | ||