Gaja Sutra gajasutra at
Wed Dec 14 09:31:02 PST 2011

> Not sure how would that IterableChangeableBuilder work. Can you give 
> an example?
[Sorry, I forgotten the openjfx-dev list the first time]

An already applied change contains the track of removed items, but only 
indexes of added.

  * public void nextAdd(int from?, int to?) {...}
  * public void nextRemove(int position, ArrayList<E> removedItems) {...}

A runnable change contains the to-be-added items, but only indexes of 

  * public void nextAdd(int position, ArrayList<E> toBeAddedItems) {...}
  * public void nextRemove(int from?, int to?) {...}

Applying a runnable change is like your setAll method but with 
caller-specified operation list (the runnable change) between 
begin-commit [no rollback, if no exception support: simpler and probably 
sufficient for collections].

|// I don't have ListChangeListener.Change source code
// then I have not reused ||ListChangeListener.Change
// (but it is probably possible and avoid RunnableChange).
||public class BatchObservableList<E> extends BaseObservableList<E> {

     public void runBatch(final RunnableChange batch) {
         for (final ListChange<E> change : batch) {
             switch (change.type) {
             case ADD:
                 addAll(change.from, change.added);
             case REMOVE:
         // this calls the ListChangeListeners using just one Change object

enum ListOperation {
     ADD, REMOVE; // etc.

static class ListChange<E> {
     ListOperation type;
     int from;
     int to;
     List<E> added;

More information about the openjfx-dev mailing list