title: Merge cells having the same value in excel Java
body: <p>I generated excel document from Postgres database, using POI API.
  The first column "Ordre" have many same values.
  However i want to merge this cells having the same values.</p>
  
  <p>I want follow this algorithm :</p>
  
  <ul>
  <li>loop through the field "ordre"</li>
  <li>put a condition if cell(i) = cell(i+1)</li>
  <li>than merge them</li>
  </ul>
  
  <p>But i have a problem with a condition how to say that <code>(cell(i) = cell(i+1))</code> in Java, i'm not keen if it can give some satisfactory result
  i started to write this code :</p>
  
  <pre><code>for (i=3; i&lt;= sheet1.getPhysicalNumberOfRows()  ; i++) {
    Cell cell = sheet1.getRow(i).getCell(0);
  
   if (sheet1.getRow(i).getCell(0).getStringCellValue() == sheet1.getRow(i+1).getCell(0).getStringCellValue())
    {
      CellRangeAddress cellRangeAddress = new CellRangeAddress(i,i+1,0,0);
      sheet1.addMergedRegion(cellRangeAddress);
    }
  }
  </code></pre>
  
  <p>Any suggestion will be appreciated</p>