title: fetching data from ArrayList
body: <p>I have method which returns List of objects, I m facing a problem while fetching a data from list, I m getting null pointer exception when i am trying to fetch the data.</p>
  
  <p>method which returns List:</p>
  
  <pre><code>public List &lt;EstimationResivion&gt; getEstimationRevision(double rev_id){
  
  List&lt;EstimationDetailRevision&gt;  estDetail=estDetailRev(rev_id);
  List&lt;EstimationPanelRev&gt; estPanelrev=estPanelRev(rev_id);
  List&lt;EstimationPannelDetailRevision&gt;   estimationpaneldetailrev=estPanelDetailRev(rev_id);
  List&lt;EstimationResivion&gt; estRev=estRevision(rev_id);
  
      EstimationResivion ed= new EstimationResivion();
      ed.setEstimationdetailRev(estDetail);
      ed.setEstimationpanelRev(estPanelrev);
      ed.setEstimationpaneldetailRev(estimationpaneldetailrev);
  
      System.out.println("Size before: "+estRev.size());
      estRev.add(ed);
  
      return estRev;
      }
  </code></pre>
  
  <p><code>estDetailRev</code> code:</p>
  
  <pre><code>private List&lt;EstimationDetailRevision&gt; estDetailRev(double d){
  
      return getJdbcTemplate().query("SELECT * FROM estimation_detail_rev WHERE rev_id=?",  new Object[] {d }, new EstimationDetailRevRowMapper());
  }
  </code></pre>
  
  <p><code>estRevision</code> code</p>
  
  <pre><code>private List&lt;EstimationResivion&gt; estRevision(double d){
  
      return getJdbcTemplate().query("SELECT * FROM estimation WHERE est_revision=?",  new Object[] {d }, new EstimationRevRowMapper());
  
  }
  </code></pre>
  
  <p><code>estRevision</code> will return list of <code>List&lt;EstimationResivion&gt;</code> which i am storing in <code>estRev</code>.</p>
  
  <p>code from where i am calling <code>getEstimationRevision</code>  and trying to fetch data from list</p>
  
  <pre><code>public void getRevision(){
  double d=0;
  List&lt;EstimationResivion&gt; est=estimationdao.getEstimationRevision(d);
  
  for(EstimationResivion er:est){
      System.out.println(er.getEstContactPerson());
      System.out.println(er.getEstCustomer());
      System.out.println(er.getRevId());
      // epd=er.getEstimationpaneldetailRev();
  
      List&lt;EstimationDetailRevision&gt;  edr=er.getEstimationdetailRev();
      for(EstimationDetailRevision estimaitonDetail:edr){
  
          estimaitonDetail.getCompCategory();
          estimaitonDetail.getCompMake();
      }
  
  }
  </code></pre>
  
  <p>I am getting null value when i call <code>er.getEstimationdetailRev();</code>
  if i specify the index i am able to getdata something like this:</p>
  
  <pre><code>List&lt;EstimationDetailRevision&gt;  edr=est.get(64).getEstimationdetailRev();
  </code></pre>
  
  <p>My question is how can i fetch data without specifying index ?</p>