i’m try to sort array list
eg.
def list = [1, 1, 4, 4, 3, 4, 1]
hope to sort :
[1, 1, 1, 4, 4, 4, 3]
Thank you very much.
i’m used to my code
eg.
def plnProcessGoalInstance = ......someting
def order = plnProcessGoalInstance.plnGoal.plnTargetPlan.id.unique() //[1, 4, 3,] ,plnProcessGoalInstance.plnGoal.plnTargetPlan.id = [1, 1, 4, 4, 3, 4, 1]
def plnProcessGoalInstance = plnProcessGoalInstance.sort{ a, b ->
order.indexOf(a.plnGoal.plnTargetPlan.id ) <=> order.indexOf(b.plnGoal.plnTargetPlan.id )}
Thank you very much for help.
How about:
Or, assuming the comment by Deruijter is correct and you want to sort by descending frequency and then by number for those with the same freq:
countByrequires Groovy 1.8