RFR: 8356486: ReverseOrderListView::reversed should return `base`
Stuart Marks
smarks at openjdk.org
Thu May 8 16:05:57 UTC 2025
On Thu, 8 May 2025 14:30:28 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposed to let `ReverseOrderListView::reversed` return `base` so that nested reversed views are avoided.
I think there are already tests to ensure that list.reversed().reversed() returns the original list. See also https://github.com/openjdk/jdk/pull/24990 which adds some tests (but these are mostly about synchronized wrappers and propagation of RandomAccess). But we can assess the need for tests after 24990 is integrated.
As I noted in the bug report ReverseOrderListView.reversed() really does end up returning base, but it does so in a roundabout fashion that could be cleaned up by adding the override as is done here.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25120#issuecomment-2863573737
More information about the core-libs-dev
mailing list