I am using Flex dictionary to store ValueObjects with Timestamp as the 'key' for each object.
Given a timestamp, I want to iterate over the dictionary starting from the given timestamp key value.
The Docs discuss the following for dictionary iteration, but this iterates from the first key-v开发者_如何学编程alue pair.
for (var key:Object in myDictionary)
{
trace(key, myDictionary[key]);
}
You could just skip all items before, like this:
for (var key:Object in myDictionary)
{
if ( key < searchKey )
continue;
trace(key, myDictionary[key]);
}
However, I believe that dictionaries do not maintain any sort order, so requiring an order with the items in the dictionary would not work.
精彩评论