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

Søren Berg Glasius <soeren-Kc6N1ySXURF/[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAGY+WWRyZ4XnxaoM2cCneRErbeBKZkNWf_6vYd=F9oHsuZHOng@mail.gmail.com>
But when you sort on the value that is an ArrayList ([it.y, it.x]) you rely
on the *hashCode()* of that ArrayList not the values inside.
So it is a coincidence that it works for others than Float/Double. The
right syntax in Groovy is as described by Paul King.

Den man. 20. maj 2024 kl. 15.25 skrev M.v.Gulik <[email protected]>:

>
> On Mon, 20 May 2024 at 15:40, Paul King <[email protected]> wrote:
>
>> What sort result are you trying to achieve? There should be no need to
>> perform any recursion.
>>
>
> Main target was reordering some set of randomly ordered x,y coordinates
> into (*for example**) a *x,y*(*left to right, top to bottom*) order (**:where
> any of the actual sort directions could be easily flipped*).
>
> So far "**.sort{[it.y, it.x]}*" seems the best and easiest way to do this
> (*despite its Float/Double caveat*).
>


-- 

Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry
Mobile: +45 40 44 91 88
--- Press ESC once to quit - twice to save the changes.
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.