Repository navigation
SharedMap order #12747
Dragos (vitamin-dragos)
started this conversation in
General
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? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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?
All reactions