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

"M.v.Gulik" <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAOSpiuHSkiETvf5GGRJ1Kaio2z6_18oxvfOVfqBv8cVSZLbp0g@mail.gmail.com>
On Mon, 20 May 2024 at 17:02, Paul King <[email protected]> wrote:

> This might even be more obvious:
>
> println ([[x:1, y:100],  [x:2, y:1], [x: 2, y:500]].sort{[it.x,
> it.y]}) // broken: [[x:2, y:1], [x:1, y:100], [x:2, y:500]]
> println ([[x:1, y:100],  [x:2, y:1], [x: 2, y:500]].sort{ a, b -> a.x
> == b.x ? a.y <=> b.y : a.x <=> b.x }) // works
>

 Aha. Thanks.
Definitely needed to see it 'not' working in one of the other value types.
+(*spotte a bug in my source code that gave me the wrong result on my
"*.sort{ a, b ->...}" test. ... it picked the wrong sort-case*. :-/ )
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.