I am not 100% sure what you are after. If you are wanting sort by x
and then y, you just want something like this:
sorttest.sort{ a, b -> a.x == b.x ? a.y <=> b.y : a.x <=> b.x }
sorttest.sort{ a, b -> a.x == b.x ? b.y <=> a.y : b.x <=> a.x } //
reverse of above
On Mon, May 20, 2024 at 6:43 AM M.
Hmm. Same deal with Float values.
(Guess I'm down to enforce BigDecimal values in case of sorting with
Float or Double values.)
I'm totally bewildered by the following. (And googling it did not help).
Erm ... markup ... don't know.
[code]
def sorttest = []
if(1){
sorttest = [[x:3,y:2],[x:4,y:1],[x:2,y:3],[x:1,y:4]]
// if(DBL){println('sorttest|1a: ' + sorttest)}
assert sorttest instanceof L