Re: Sort on linkedlists with double values (inside main list)

"M.v.Gulik" <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAOSpiuHkeHbyek9266Js5KcRJGbfj8pNGpZDkTmWPGM6dr-HUw@mail.gmail.com>
On Tue, 21 May 2024 at 14:01, Paul King <[email protected]> wrote:

> On Tue, May 21, 2024 at 3:13 PM M.v.Gulik <[email protected]> wrote:
> >
> > After fixing my local bug I rechecked the "*.sort{ a, b -> a.y == b.y ?
> -a.y <=> -b.y : a.x <=> b.x }" variant.
> > Same result/conclusion.
>
> In terms of referencing the properties, you'd want to swap the order
> you have above, i.e. you'd not want to have y ? y : x but rather y ? x
> : y or x ? y : x.
>

Darn. Yea, your right. I messed it up (again) :-/ .
After fixing that (and triple checking) it worked like advertised.
Thanks again.

On Tue, 21 May 2024 at 14:01, Paul King <[email protected]> wrote:

> Also, the "*.sort" would only be needed if you have lists of lists of maps.
>

Ditching that "<varname>.sort{ a, b -> a.x <=> b.x }.sort{ a, b -> -a.y <=>
-b.y}" idea of mine.
(might play around with it a bit more on a rainy day to see in which cases
it would fail, just out of curiosity.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.