code: public static <T> Subscription includeWhen(
              Collection<T> collection,
              T element,
              ObservableValue<Boolean> condition) {
          return subscribe(condition, new Consumer<Boolean>() {
              private boolean included = false;
  
              @Override
              public void accept(Boolean value) {
                  if(value && !included) {
                      included = collection.add(element);
                  } else if(!value && included) {
                      collection.remove(element);
                      included = false;
                  }
              }
          });
      }
docs: Adds {@code element} to {@code collection} when {@code condition} is
  {@code true} and removes it from {@code collection} when
  {@code condition} is {@code false}.
  @return a subscription that can be used to stop observing
  {@code condition} and manipulating {@code collection}.