title: For loop seems to be running more than necessary in Java
body: <pre><code>for(LogProcess process : lo) {
    for(PathInfo info : process.getPathinfolist()) {
      a1.add(info.getFilepath());
    }
  }
  </code></pre>
  
  <p>I have this piece of code here. <code>lo</code> is an instance of a <code>LinkedList</code> of size.</p>
  
  <p>The <code>LinkedList</code> is of:</p>
  
  <pre><code>public LogProcess(int rev, String auth, String date,
                    List&lt;PathInfo&gt; pathinfolist)
  </code></pre>
  
  <p>Now <code>PathInfo</code> is of:</p>
  
  <pre><code>public PathInfo(String action,String kind,String filepath)
  </code></pre>
  
  <p>Now my <code>LinkedList</code> size is <code>130</code>. And that is fine.</p>
  
  <p>But <code>process.getPathInfoList()</code> is reading <code>1657</code> records from xml. However after the loop when I check the size of <code>a1</code> using <code>a1.size()</code> it shows <code>7216</code> which is impossible. Where am I wrong?</p>