title: Writing an excel sheet using poi and hashmaps
body: <p>I am attempting to write an excel sheet using POI and hashMaps. My code successfully creates and populates an excel sheet but not all of the information is written to the sheet. In debug mode it seems to write 5 key, value pairs and then loops to the start at key [0]. Can someone tell me where the mistake is in my logic?</p>
  
  <pre><code>HSSFWorkbook workbook = new HSSFWorkbook();
          HSSFSheet sheet = workbook.createSheet(make + " sheet");
          int rowNum = 0;
          ConcurrentHashMap &lt;Integer, String[] &gt; data = new 
                          ConcurrentHashMap&lt;Integer, String[]&gt;();
  
          data.put(rowNum++, new String[] {"VIN", "Make", "Model", "Year", 
                          "Major Group", "Caption", "Cap Filter", "Illustration",
                          "Illus Filter", "PNC", "Part Name", "Part Number", "Quantity",
                          "Part Filter"});
  
          for (Part p : plist){
              String PNC = p.getPNC();
              String quantity = p.getQuantity();
  
              if(vFilterId.contains(p.getId())) {
                  data.put(rowNum++ , new String[] {vinId, make, 
                                      model, year, group, caption, capFilter, illusName,
                                      iFilter, PNC, p.getName(), p.getPartNumber(), 
                                      quantity, "NONFILTERED"});
  
              } else {
                  data.put(rowNum++ , new String[] {vinId, make, 
                                      model, year, group, caption, capFilter, illusName,
                                      iFilter, PNC, p.getName(), p.getPartNumber(), 
                                      quantity, "NONFILTERED"});
  
              }
  
          }
          int rowIndex = 0;
          Set&lt;Integer&gt; keyset = data.keySet();
          for (Integer key : keyset) {
              Row row = sheet.createRow(rowIndex++);
              Object[] objArr = data.get(key);
              int cellIndex = 0;
              for (Object obj : objArr) {
                  Cell cell = row.createCell(cellIndex++);
                  cell.setCellValue((String) obj);
              }
  
          }
  
          try {
              FileOutputStream fos = new FileOutputStream(outputFile);
              workbook.write(fos);
              fos.close();
              System.out.println("XLS sheet written.");
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
      return ReturnConstants.SUCCESS;
  }
  </code></pre>
  
  <p>Thanks in advance!</p>