Here's a real quick Groovy snippet demonstrating one way to sort a Map by the values stored in its entries (mostly so I don't forget how to do it):
def map = ["ghi":6, "abc":4 ,"def":5]
def sortedByValue = map.sort { a,b -> a.value <=> b.value }
println sortedByValue.keySet()
[abc, def, ghi]Anyone have any other methods for doing the same thing?
Thanks for providing the best information it's very useful sap basis learners.
ReplyDeleteSAP BASIS Course in Hyderabad
Online SAP BASIS Training in USA