SharedMap order #12747
Replies: 1 comment
-
When you say "keep the order of the elements," do you mean "is the iteration order of elements in the map guaranteed?" I don't know! 😀 But SharedMaps strive to match the built-in JS Map type, for which MDN says, "Iteration happens in insertion order, which corresponds to the order in which each key-value pair was first inserted into the map by the set() method (that is, there wasn't a key with the same value already in the map when set() was called)." I was surprised by that! I didn't expect the order to be guaranteed in any way. But based on that and the expressed design intent of SharedMap, I would expect SharedMaps to behave similarly. What behavior have you observed in your testing? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm curious... does SharedMap keep the order of the elements?
We have a list of elements (each with its own ID) and we're considering using a SharedMap by setting those ids as map keys. But would the order be kept intact?
Beta Was this translation helpful? Give feedback.
All reactions