I have a TDictionary. It’s being filled with an extensive loop. When the loop finishes I need to retrieve the 10 keys(string) with more score(integer). What would be the most efficient way to accomplish this?
In Objective-C(Cocoa) I do it with:
NSArray *top_words_sorted_array = [top_words_dictionary keysSortedByValueUsingSelector:@selector(compare:)];
and then iterating the new sorted array. How can I do it in Delphi?
The equivalent Delphi code to your Cocoa code is:
If your dictionary is very large then this will not be the most efficient solution. On the other hand, it’s probably the quickest and easiest approach to implement.