DuplicatePolicy Enumeration

Describes how duplicate values are handled when inserting into a SortedArray. A "duplicate" value is one that compares equal to a value already present in the array, per the array's comparison function.

Members

Name Value Description
Allow The array allows duplicate values to be inserted. All duplicate values will be adjacent in the array, but the ordering between duplicate values is unspecified.

@note In the presence of duplicate values, functions like indexOf and findEqual will return one of the values - exactly which one is unspecified.
Replace Duplicate values are forbidden - when attempting to insert a value equivalent to one already present, the already-present value is replaced by the new value.
This can be useful when the value type carries additional data that is not evaluated by the comparison function.
Retain Duplicate values are forbidden - when attempting to insert a value equivalent to one already present, the already-present value is retained.

Defined in

Last Updated: 21 November, 2024