title: Storing data to Java Collection from Excel file
body: <p>I'd like to read data from Excel file and would want to store into Java collection something like HashMap or something.</p>
  
  <p>I've implemented Excel reading through Apache POI- That part is working pretty fine.
  Now I'm wondering how to store that data into HashMap.</p>
  
  <p>I've created 1 POJO class having values of Excel data.</p>
  
  <pre><code>Class EmpXcel
      private String emp_name;
      private String emp_job;
  
       // parameterised constructor
  
       // getter-setter
  </code></pre>
  
  <p>Now If I create the HashMap of type of this particular POJO Class.</p>
  
  <p>For ex. <code>Map&lt;String, EmpXcel&gt; map =  new HashMap&lt;String, EmpXcel&gt;();</code></p>
  
  <p>This is my Code for reading data from Excel.</p>
  
  <pre><code>while(itr.hasNext()){
              Row nextRow = itr.next();
              // For each row, iterate through all the columns
              Iterator&lt;Cell&gt; cellIterator = nextRow.cellIterator();
  
              while (cellIterator.hasNext()) 
              {
                  Cell cell = cellIterator.next();
  
                  switch (cell.getCellType()) 
                  {
                      //  if cell is numeric format   
                      case Cell.CELL_TYPE_NUMERIC:
                          System.out.print(cell.getNumericCellValue()+",");
                          break;
  
                      // if cell is string format
                      case Cell.CELL_TYPE_STRING:
                          System.out.print(cell.getStringCellValue() + ",");
                          break;
                  }
              } 
           System.out.println();
      }
  </code></pre>
  
  <p>I'm not sure How to store this data into HashMap of type POJO class(Here EmpXcel).</p>
  
  <p>EDIT: Excel table:</p>
  
  <pre><code>Emp_Name |  Emp_Job
  
  Travis   |  Technical Assistant
  
  John     |  Professor
  </code></pre>
  
  <p>Also I'd like to make it more generic- want to create single Java class for different Excel files(irrespective of the no of rows/cols)</p>
  
  <p>Please share me some of your insight so I can follow that way.</p>
  
  <p>Thanks.</p>