title: Adding integer arraylist to arraylist in android
body: <p>I need to make a 2D arraylist like </p>
  
  <pre><code>[[1,2,3],[2,3,4],[3,4,5]]
  </code></pre>
  
  <p>But by using the below code I am getting only</p>
  
  <pre><code>[[3,4,5],[3,4,5],[3,4,5]]
  </code></pre>
  
  <p>The last array simply gets repeated again and again.
   While traversing through the problem, I found that in first pass its like</p>
  
  <pre><code>[[1,2,3]
  </code></pre>
  
  <p>2nd pass:</p>
  
  <pre><code>[[2,3,4],[2,3,4]]
  </code></pre>
  
  <p>3rd pass:</p>
  
  <pre><code>[[3,4,5],[3,4,5],[3,4,5]].
  </code></pre>
  
  <p>Please help, as i m stuck with it.</p>
  
  <pre><code>ArrayList&lt;ArrayList&lt;Integer&gt;&gt; combiarray = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;();
  ArrayList&lt;Integer&gt; innerarray = new ArrayList&lt;Integer&gt;();
  
  combiarray.clear();
  
  for(k=1;k&lt;(row*column);k=k+column)
  {
      for(j=k;;j++)
          {
              innerarray.clear();
              for(i=0;i&lt;wincount;i++)
              {
                  innerarray.add(j+i);
              }
  
              combiarray.add(innerarray);
              Toast.makeText(context,String.valueOf(combiarray),
                                   Toast.LENGTH_SHORT).show();
              i--;
              if((j+i)%column==0)
              {
                  break;
              }
          }
      }
  </code></pre>