title: fetching data from excel when cell contains null value
body: <p>I am fetching data from excel and I need to count rows where some cell contains null value. The code is returning nothing. For lines which contains some values in this cell it is working correctly. Can you help me how to handle cells with null value?</p>
  
  <p>The code is following:</p>
  
  <pre><code>HSSFSheet sheet = workbook.getSheetAt(1);
  
          // Get iterator to all the rows in current sheet
          Iterator&lt;Row&gt; rowIterator = sheet.iterator();
  
          // Iterate through rows
          while (rowIterator.hasNext()) {
              Row row = rowIterator.next();
  
              // Index of column D is 3 (A-&gt;0, B-&gt;1, etc)
              Cell cellD = row.getCell(3);
              Cell cellG = row.getCell(6);
  
              //
              String key = null;
              Integer value = null;
  
              // finding cell type
              int cellTypeG = cellG.getCellType();
  
              // getting value from first cell
              key = cellD.getStringCellValue();
  
  
              // fetching value to the Double, to be able to compare data
              if (Cell.CELL_TYPE_NUMERIC == cellTypeG) {
                  value = new Double(cellG.getNumericCellValue()).intValue();
                   if (value != null) {
                      if (map.containsKey(key)) {
                          map.put(key, map.get(key) + 1);
                      } else {
                          map.put(key, 1);
                      }
  
                  } 
              }
          }
  
          // cycle which is filling the map
          for (Entry&lt;String, Integer&gt; e : map.entrySet()) {
              System.out.println(e.getKey() + ": " + e.getValue());
          }
  </code></pre>