Пример #1
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);
   }
 }
 public void cleanup() {
   observableList.removeListener(this);
 }