replace a section of ObservableList in one operation?

Martin Sladecek martin.sladecek at oracle.com
Mon Sep 2 05:40:34 PDT 2013


Hi Tomas,
unfortunately, this is not possible.
I have filed a JIRA issue https://javafx-jira.kenai.com/browse/RT-32655 
for the setAll method with range.

The subList doesn't return an ObservableList, as the sublists become 
invalid once there's some structural change on the list. That would mean 
to watch and (silently) invalidate the listeners too, which might be 
confusing.

-Martin

On 09/02/2013 02:22 PM, Tomas Mikula wrote:
> Hi,
>
> I cannot find a way to replace a section of ObservableList in one
> operation. I'm looking for something like
>
> ObservableList<E>#setAll(int from, int to, Collection<? extends E> col)
>
> or
>
> list.subList(from, to).setAll(col).
>
> In the latter case, ObservableList#subList() would have to return an
> instance of ObservableList, not just List.
>
> I know I can use a pair of remove() and addAll(), but my objective is
> to generate just 1 change event.
> Is there a way to achieve this?
>
> Thank you,
> Tomas



More information about the openjfx-dev mailing list