Search code examples
javajavafxreactfx

ReactFX Val, how do I get binding for null status?


In JavaFX's Property you can obtain a boolean binding for null or non null via val.isNull() and val.isNonNull().

What's the equivalence for this in ReactFX?

I've tried:

val.map(v -> v == null)

But it would return a Val<Boolean> with the actual value null instead of true (which is as expected in other cases).


Solution

  • I think

    val.map(v -> false).orElseConst(true)
    

    will give you what you need.