RxJavaFX icon indicating copy to clipboard operation
RxJavaFX copied to clipboard

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

Open pkrysztofiak opened this issue 7 years ago • 1 comments

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);
}

pkrysztofiak avatar Nov 10 '18 13:11 pkrysztofiak

Noted, okay.

thomasnield avatar Nov 12 '18 13:11 thomasnield