Annoyances of Flex - Associative Array
-
13-09-2019 - |
Question
I have an associative array and while iterating through this array, using foreach loop. Flex is loosing the order. This is so annoying.
Why is this happening?
How can i avoid this?
Solution
Per the specification, the values in an associative array are not "ordered".
If you need to get values in a specified order, you'll need to sort the keys yourself.
OTHER TIPS
Associative arrays are implementation of the Hash table data structure, and hence are unordered by nature.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow