You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible defining a sorting criteria in SortedDictionary? I'm using this data structure but i need to sort elements in order descending directly.
Yes, I use SortedDictionary.reversed() to get an array of tuple..but i wanna reduce my algorithm complexity, trying to perform only one iteration. It could be useful implementing a custom comparable closure, like TreeMap in Java.
Activity
daniel-jonathan commentedon May 11, 2017
The SortedDictionary is sorted by its key value. So if you want to access it in descending order, you can access it backwards. For example:
Something like that should work. If you need, please reopen the issue. All the best!
andreadelfante commentedon May 12, 2017
Yes, I use SortedDictionary.reversed() to get an array of tuple..but i wanna reduce my algorithm complexity, trying to perform only one iteration. It could be useful implementing a custom comparable closure, like TreeMap in Java.
daniel-jonathan commentedon May 14, 2017
That is a good idea, I will look into that.
daniel-jonathan commentedon May 15, 2017
Here is an issue for your feature request: #7. Thank you!