Map keys order when iterating

Map keys order when iterating

guiroehe
Collaborator Collaborator
104 Views
1 Reply
Message 1 of 2

Map keys order when iterating

guiroehe
Collaborator
Collaborator

Is there a way to make a Map maintain the order the keys are inserted when iterating on a loop?

Thank you.

0 Likes
Accepted solutions (1)
105 Views
1 Reply
Reply (1)
Message 2 of 2

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

I think, it is not a feature.


Key Ordering

The Map class is a hash map, so keys in the map are in not guaranteed to be in any order. They are not sorted by comparison, and they are not in insertion order. Even if it appears that you can depend on some particular ordering, that ordering could easily change in a bug fix release or new version of FlexSim.

 

Please see here in API class reference