On Sun, 27 Jun 2021 12:45:35 GMT, Marius Hanl <mh...@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

Reply via email to