Skip to content

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

Open
@pkrysztofiak

Description

@pkrysztofiak

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions