On Thu, 16 Jan 2025 18:26:37 GMT, Andy Goryachev <[email protected]> wrote:
> One possible alternative is to create the defensive copy each time, this will
> save one extra pointer every time an iterator or a sublist gets created
> (these objects might be long lived). The code in this PR creates a copy in
> many (most?) cases anyway, and in my opinion, the memory is more precious
> resource that CPU cycles (i.e. using extra memory costs many more CPU cycles
> in garbage collection etc.), so please consider that.
I don't quite understand what you mean. Can you elaborate?
In particular, what does "save one extra pointer" mean?
> modules/javafx.base/src/test/java/test/javafx/collections/VetoableObservableListTest.java
> line 212:
>
>> 210: list.addAll(list.subList(0, 2));
>> 211: assertSingleCall(new String[] {"foo", "bar"}, new int[] {4, 4});
>> 212: }
>
> suggestion: also check that the list contains the newly added elements?
> (here and in added tests that involve subList?)
I've added checks for the list content in all modified tests.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1679#issuecomment-2616596847
PR Review Comment: https://git.openjdk.org/jfx/pull/1679#discussion_r1931014326