ReactiveX / RxJavaFX

RxJava bindings for JavaFX
Apache License 2.0
519 stars 67 forks source link

JavaFxObservable.valuesOf(fxObservable, nullSentinel) does not emmit first nullSentinel #75

Open pkrysztofiak opened 6 years ago

pkrysztofiak commented 6 years ago

In my opinion the first/initial emission of nullSentinel is missing:

ObjectProperty<String> stringProperty = new SimpleObjectProperty<>();
JavaFxObservable.valuesOf(stringProperty, "N/A").subscribe(System.out::println);  
stringProperty.set("one");  
stringProperty.set(null);  
stringProperty.set("two");

Output: one N/A two

I would add "else" block just after "if" at ObservableValueSource:50

if (fxObservable.getValue() != null) {
    emitter.onNext(fxObservable.getValue());
} else {
    emitter.onNext(nullSentinel);
}
thomasnield commented 6 years ago

Noted, okay.