org.reactfx.value.OrElseConst Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reactfx Show documentation
Show all versions of reactfx Show documentation
Reactive event streams for JavaFX
The newest version!
package org.reactfx.value;
import javafx.beans.value.ObservableValue;
import org.reactfx.Subscription;
class OrElseConst extends ValBase {
private final ObservableValue extends T> src;
private final T other;
OrElseConst(ObservableValue extends T> src, T other) {
this.src = src;
this.other = other;
}
@Override
protected T computeValue() {
T val = src.getValue();
return val != null ? val : other;
}
@Override
protected Subscription connect() {
return Val.observeInvalidations(src, obs -> invalidate());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy