title: Java setCellValueFactory lambda expression when null is possible
body: <p>I have the following line of code to set up a column in JavaFX:</p>
  
  <p><code>branchActionColumn.setCellValueFactory(cd -&gt; cd.getValue().getAction().getTextProperty());</code></p>
  
  <p>This typically works fine.  However, sometimes <code>getAction()</code> returns null (and that can be normal behavior).  In that case I'd like to just display the empty string "".  How could I do that?</p>
  
  <p>I've tried:</p>
  
  <p><code>branchActionColumn.setCellValueFactory(cd -&gt; (cd.getValue().getAction() == null) ? new SimpleStringProperty("") : cd.getValue().getAction().getTextProperty());</code></p>
  
  <p>While this displays the initial value of the property in the TableView, any subsequent changes made to the property are not reflected in the TableView.  I believe this is because I am creating a new property inside the lambda expression.</p>
  
  <p>If I go back to the line <code>branchActionColumn.setCellValueFactory(cd -&gt; cd.getValue().getAction().getTextProperty());</code> then the TableView responds appropriately whenever the property changes.  This is the behavior that I want.  I just also want it to handle the case when <code>getAction()</code> returns null.</p>
  
  <p>Here is a similar question, but it's for C# and it's not related to a CellValueFactory: <a href="https://stackoverflow.com/questions/32184843/c-in-list-convertall-method-using-lambda-expression-how-to-make-a-filter-wh">C#, in List&lt;&gt;.ConvertAll method using lambda expression, how to make a filter when the object is null?</a></p>