What would be the best way to create an array that can have an index and a key at the same time ?
i mean something like this
index | key | value
0 | "myItem" | "Some value"
1 | "anotherItem" | "Some other value"
2 | "blabla" | "Bla Bla"
I know i can create a normal Array/Vector and then use an Object/Dictionary to map the keys to the index in the current array.
But if the array changes then the Dictionary needs to change all the indexes that would have been affected because an item has been removed for example. I can go ahead and create a class that tries to synchronize the map with the array etc... But i dont think it is the best way of doing it at all... :)
I wanna use it to have a list... that holds queued items for example. You should be able to get a particular item by its key :
item = list["myItem"]
But you should also be able to find out the index of an item, they have to be ordened , and it should be possible to loop through it as a normal array.
What would be the best way to do something like this in as3 ?