title: How to add array of items to a JavaFX table view
body: <p>Following is my code. The items array has 12 elements. I want to add it to Table view. But it adds last item 12 times to the table. How can I fix this. Thanks.</p>
  
  <pre><code>@Override
  public void initialize(URL url, ResourceBundle rb) {
  
      col1.setCellValueFactory(new PropertyValueFactory&lt;View, String&gt;("name"));
      col2.setCellValueFactory(new PropertyValueFactory&lt;View, String&gt;("qty"));
      col3.setCellValueFactory(new PropertyValueFactory&lt;View, String&gt;("price"));
  
      ObservableList data = FXCollections.observableArrayList();
      View view = new View();
      table.setItems(data);
  
      for(Item item : items){
          view.name.set(item.getItem());
          view.price.set(String.valueOf(item.getPrice()));
          view.qty.set(String.valueOf(item.getAmount()));
          data.add(view);
      }
  
      lblTotalpr.setText(String.valueOf(ttl));
  }
  </code></pre>