RFR: 8196065: ListChangeListener getRemoved() returns items that were not removed. [v10]
Michael Strauß
mstrauss at openjdk.java.net
Sun Jun 27 13:19:09 UTC 2021
On Sun, 27 Jun 2021 12:45:35 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
>> Without the check, it would be possible to inspect the size without calling `next()` first.
>
> Right. But I want to understand why this was not there before.
>
> Is this needed, because if you didn't called `next()`, there is no change yet to retrieve the removed size?
It is needed according to the documentation of `ListChangeListener.Change`:
_Important: It's necessary to call next() method before calling any other method of Change. The same applies after calling reset(). The only methods that works at any time is getList()._
Also, it intuitively makes sense: a `Change` can consist of any number of sub-changes, so you need to select a sub-change first by calling `next()` before any of the other methods can be meaningfully called.
-------------
PR: https://git.openjdk.java.net/jfx/pull/478
More information about the openjfx-dev
mailing list