title: How to get data from TableModel faster in Java?
body: <p>I want to export data from JTable to a file in CSV format. For read all data in TableModel i've used this:</p>
  
  <pre><code>for (int row = 0; row &lt; rowCount; row++) {
    for (int col = 0; col &lt; columnCount; col++) {
      csvData += tableModel.getValueAt(row, col);
      csvData += col + 1 &lt; columnCount ? "," : "";
    }
    csvData += "\r\n";
  }
  </code></pre>
  
  <p>But for a large dataset the process is too slow. And i think the reason is not the loop itself, but getValueAt method that is slow.</p>
  
  <p>So I ask if there is a faster way to get data from TableModel?</p>