You need to sign in to do that
Don't have an account?
swain 10
Sorting a Map on descending order basis of one score field(decimal)
Map<Id,decimal> allResultMap = new Map<Id,decimal>();
I need to sort in descending order on the basis of the score field which is of type decimal.
I need to sort in descending order on the basis of the score field which is of type decimal.
Map do not hae sorting supported, they are a key value pair collection. Now for your issue you need a sorting algo to work and create a list of key according to the order you want. You can use linear search algo or bubble sort from data structure.
Hope this helps.Sorting on map is not possible. But if you want to sort map with there key then we can do something like this :
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra