title: for each loop and recursion for an arrayList
body: <p>I have a problem to understanding this method.
  we have a simple implementation of Tree-structure with the composite pattern.
  so the tree is for example :  </p>
  
  <pre><code>                             **1
                              2     erwin
                         true 4 5      6**
  </code></pre>
  
  <p>so root=1 and 2 have the children (true ,4,5) so on....
  with this function there are the nodes calculated on a Level: </p>
  
  <pre><code>**public int nodeInLevel(int level){
          int out =0;
          if(level==0)    return 1;
          System.out.println("level for forLoop : "+(level)+"  " +out);
          System.out.println("subtrees"+this.subtrees);
          for(Tree b:this.subtrees){
              out += b.nodeInLevel(level-1); 
              System.out.println("level "+(level)+"  " +out);
          }
          return out;
  
      }**
  </code></pre>
  
  <p>for level 2 ther are 4 and I use the SYSo so I understand how it works and this is the output.</p>
  
  <pre><code>level for forLoop : 2  0
  level for forLoop : 1  0
  level 1  1
  level 1  2
  level 1  3
  level 2  3
  level for forLoop : 1  0
  level 1  1
  level 2  4
  4
  </code></pre>
  
  <p>I don't understand why level has not been decremented in the forEach loop because although we recursively call the function knotenInLevel(level-1)
  Thanks in advance</p>