Exemple #1
0
 static <E> EventStream<QuasiListChange<? extends E>> quasiChangesOf(ObservableList<E> list) {
   if (list instanceof LiveList) {
     LiveList<E> lst = (LiveList<E>) list;
     return lst.quasiChanges();
   } else {
     return new EventStreamBase<QuasiListChange<? extends E>>() {
       @Override
       protected Subscription observeInputs() {
         return LiveList.<E>observeQuasiChanges(list, this::emit);
       }
     };
   }
 }
Exemple #2
0
 static <E> Subscription observeQuasiChanges(
     ObservableList<? extends E> list, QuasiChangeObserver<? super E> observer) {
   if (list instanceof LiveList) {
     LiveList<? extends E> lst = (LiveList<? extends E>) list;
     return lst.observeQuasiChanges(observer);
   } else {
     ListChangeListener<E> listener =
         ch -> {
           QuasiListChange<? extends E> change = QuasiListChange.from(ch);
           observer.onChange(change);
         };
     list.addListener(listener);
     return () -> list.removeListener(listener);
   }
 }