[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: RFR: 8196065: ListChangeListener getRemoved() returns items that were not removed. [v10]
From: Michael =?UTF-8?B?U3RyYXXDnw==?= <mstrauss () openjdk ! java ! net>
Date: 2021-06-27 13:19:09
Message-ID: d0-YJPzPEHpsADalb013000wywBNol2aIjv5SwMrMCU=.da2e2e4d-ed06-4b8b-9a5d-adb7266705fd () github ! com
[Download RAW message or body]
On Sun, 27 Jun 2021 12:45:35 GMT, Marius Hanl <mhanl@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic