RFR: 8301761: The sorting of the SortedList can become invalid [v2]

John Hendrikx jhendrikx at openjdk.org
Sat Aug 10 11:55:35 UTC 2024


On Sat, 10 Aug 2024 07:10:03 GMT, Loay Ghreeb <duke at openjdk.org> wrote:

> Shift + Click again on Col2 to remove the sort from Col2. The order will stay the same [1, 0, 3, 2], but the expected order is [1, 0, 2, 3] as in step 2.

Why is that the expected order?  It is "a" possible, but valid order.  When only sorting on `Col1` then in my opinion [1, 0, 2, 3], [1, 0, 3, 2], [1, 2, 0, 3], etc.. are all valid sort orders.

If we want to distinguish between equal elements to give them a fixed sub-ordering (and the inverse one I suppose when the sort is descending) then what should the distinguishing factor be?  Its position in the underlying unsorted list?  The time it was added to the underlying list?  They need not be the same.  Using the position in the underlying list could be quite random if the source of the list doesn't guarantee a fixed position (from an unsorted database query for example).

What if the underlying list is another sorted list or a filtered list, can we even rely on the indices those provide?

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1519#issuecomment-2281285791


More information about the openjfx-dev mailing list