title: Filtering ObservableList with CheckBox in JavaFX
body: <p>I'm building a log reader with JavaFX as a side project and have gotten to a dead end when trying to implement filtering on the <code>TableView</code>.</p>
  
  <p>What I have is a few <code>CheckBox</code>es (LHS of the picture) that will basically act as the filters for what the <code>TableView</code> will display:</p>
  
  <p><a href="https://i.stack.imgur.com/I5rvg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I5rvg.png" alt="Window"></a></p>
  
  <p>Once the <code>Submit</code> button is clicked, a background thread is opened to read the and parse the files. Once the operation terminates, the result of each log read is inserted into the global <code>ObservableList&lt;Log&gt;</code>:</p>
  
  <pre><code> public class Test_Filters extends Application {...
  
   private ObservableList&lt;LogTest&gt; logs = FXCollections.observableArrayList();
  
  ...}
  </code></pre>
  
  <p>What I'm having trouble with is how to deal with:</p>
  
  <ol>
  <li>A situation where more than one filter <code>CheckBox</code> is checked.</li>
  <li>A situation where the <code>CheckBox</code> is unchecked.</li>
  </ol>
  
  <p>For 1., I was wondering what's the best way to deal with this. Let's say I have <code>x</code> filters selected. This would mean that I have to basically filter out <code>x</code> values from the <code>ObservaleList</code>:</p>
  
  <pre><code>logTable.setItems(logTable.getItems().filtered(log -&gt; !log.getSource().equals(checkBox.getText())));
  </code></pre>