title: JavaFX: Grouping table view with sum function
body: <p>I have an observable list containing persons:</p>
  
  <pre><code>ObservableList&lt;Person&gt; persons = FXCollections.observableArrayList();
  </code></pre>
  
  <p>And a class Person:</p>
  
  <pre><code>public class Person {
      private final StringProperty name = new SimpleStringProperty();
      private final IntegerProperty count = new SimpleIntegerProperty();
      // ...
  }
  </code></pre>
  
  <p>Now I can display them in a table like this:</p>
  
  <pre><code>TableView&lt;Person&gt; table = new TableView&lt;&gt;(persons);
  
  TableColumn&lt;Person, String&gt; name = new TableColumn&lt;&gt;("Name");
  name.setCellValueFactory(cell -&gt; cell.getValue().nameProperty());
  
  TableColumn&lt;Person, Number&gt; count = new TableColumn&lt;&gt;("Count");
  count.setCellValueFactory(cell -&gt; cell.getValue().countProperty());
  
  table.getColumns().addAll(name, count);
  </code></pre>
  
  <p>If there are multiple persons with the same name, it will appear multiple times.</p>
  
  <p>Now I'd like to display each name in the table only once and sum the count together.</p>
  
  <p>In SQL for example it would be a group by function.</p>
  
  <p>How can I do this in JavaFX?</p>