Ordered Multi-Map ORDMAPM

Language enhancement: new collection type ORDMAPM is equivalent to ORDMAP except it supports multiple keys of the same value. This structure is typically known as an ordered multi-map but we went with ORDMAPM instead ORDMMAP or ORDMULMAP or ORDMULTIMAP because it seemed easier to read and type.

As with the standard ORDMAP, ORDMAPM collections declared with the DIMX statement and support the same two variations (one with a variable length string value, the other with a variable length binary/blob value; both with a variable length string key):

DIMX $mymap, ORDMAPM(varstr;varstr)

dimx $mymap, ordmapm(varstr;varx)

 

Note that are no promises regarding the internal order of elements with the same key, nor of which of those elements will be the one returned when retrieving an element by key. However, iterating through the entire array will return all of the elements. In addition, iterating from a specific key will also return all of the matches for that key.

For example:

dimx $MM, ORDMAPM(varstr;varstr)

...

foreach $$i in $MM(key$)   ! will iterate through all of the elements

....                       ! matching $key, followed by all of the

next $$i                   ! elements after $key