RFR: 8251946: ObservableList.setAll does not conform to specification [v2]
Kevin Rushforth
kcr at openjdk.java.net
Fri Sep 25 15:51:38 UTC 2020
On Fri, 25 Sep 2020 10:23:54 GMT, Leon Linhart <github.com+4029915+TheMrMilchmann at openjdk.org> wrote:
>> modules/javafx.base/src/main/java/javafx/collections/ModifiableObservableListBase.java line 97:
>>
>>> 95: clear();
>>> 96: addAll(col);
>>> 97: return true;
>>
>> I think following code would be more suitable here,
>> boolean res = super.addAll(c);
>> return res;
>> This code is already used in two `addAll()` methods of this class.
>
> Makes sense to me. I changed it accordingly.
I don't think this change is correct. `setAll(Collection)` should return true if the list is modified. As discussed in
an [earlier comment](#issuecomment-684117392) this means returning true if either the existing Collection or the new
Collection is non-empty.
-------------
PR: https://git.openjdk.java.net/jfx/pull/284
More information about the openjfx-dev
mailing list