RFR: 8253086: Optimization of removeAll and retainAll of ObservableListWrapper [v4]
Jeanette Winzenburg
fastegal at openjdk.java.net
Wed Oct 7 09:41:04 UTC 2020
On Wed, 7 Oct 2020 08:07:52 GMT, yosbits <github.com+7517141+yososs at openjdk.org> wrote:
>
>
> The error occurs as specified in getSelectedItems().
no, both spec and implementation (at least as far as its relation to this issue) is correct.
> It seems to be correct to write the following
>
> `listView.getItems().removeAll(new HashSet<>(selectedItems)) `
>
> (or ArrayList)
>
asking client code to adopt to changes in the framework is not an option
> It could be interpreted that the intention was to mitigate the side effects associated with the getSelectedItems()
> specification.
no side-effects, nothing mitigated, : it's a deliberate, full-fledged support of source lists that change on removing
items from the target list
> The use of BitSet should be avoided when the list is large, as it is not a sparse implementation and therefore wastes a
> lot of memory. For example, when removing the last item in the list.
> `BitSet bs = new BitSet(c.size()); `
> The previous change was an incorrect initialization size for BitSet.
feel free to suggest another (working without requiring changes to client code) two-pass approach in remove/retainAll.
-------------
PR: https://git.openjdk.java.net/jfx/pull/305
More information about the openjfx-dev
mailing list