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

John Hendrikx jhendrikx at openjdk.org
Fri Aug 9 19:13:37 UTC 2024


On Fri, 9 Aug 2024 03:30:09 GMT, Loay Ghreeb <duke at openjdk.org> wrote:

>> Fix an issue in `SortedList` where the sorting became incorrect when adding new items that are equal to existing items according to the comparator. The `SortedList` should consider the insertion index of these items to maintain the correct order.
>
> Loay Ghreeb has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Merge branch 'master' into SortedList
>  - Merge branch 'master' into SortedList
>  - Merge branch 'master' into SortedList
>  - Add test case
>  - Fix SortedList to maintain insertion order for equal elements

The PR title "The sorting of the SortedList can become invalid" seems to imply that the sorting can become incorrect, as in the incorrect order.

This is not the case. The sorting is still correct. Claiming that the sorting is invalid because a newly added item was not placed in a specific location relative to other equal items is a bit of misrepresentation.

So, if this PR wants to move forward, I think we first need to decide if we want to guarantee a specific behavior when inserting new but equal elements.  If we do, then it should be documented, and also maintained when the list gets resorted (ie. resorts must be stable).

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

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


More information about the openjfx-dev mailing list