title: ArrayList of ArrayList of ArrayList incorrect retrieval
body: <p>I am creating an ArrayList of Arraylist of ArrayList and am populating it the way below. It populates it correctly. I have figured that out through debug and <code>println</code>. But when I try to retrieve those integers, it does not work correctly and shows me the last integer from the file which I have read for all the values of my ArrayList variable.</p>
  
  <p>Below is the code where I populate and it works well.   </p>
  
  <pre><code>    Scanner sc = new Scanner(new File("e1.txt"));
      Scanner lineSc;
      String lineStr;
  
  
      String lineRegEx = "(\\d+),(\\d+)";
      Pattern linePattern = Pattern.compile(lineRegEx);
      Matcher matcher;
  
      Integer vertex = 0, edge = 0, length = 0;
      String strE, strL ;
      ArrayList&lt;Integer&gt; tmpLE = new ArrayList&lt;Integer&gt;() ;
      ArrayList&lt;ArrayList&lt;Integer&gt;&gt; singleV = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;() ;
  
      sc.useDelimiter("\\n");
  
  
      int i = 0, j = 0;
      while (sc.hasNextLine()) {
          lineStr = sc.nextLine();
          lineSc = new Scanner(lineStr);
  
          lineSc.nextInt(); 
  
          matcher = linePattern.matcher(lineStr);
  
          while (matcher.find()) {
                  strE = matcher.group(1);
                  edge = Integer.parseInt(strE);
                  tmpLE.add(EI, edge);
                  strL = matcher.group(2);
                  length = Integer.parseInt(strL);
                  tmpLE.add(LI, length);
  
                  singleV.add(j ,tmpLE);
                  graph.add(i, singleV);
                  //System.out.println (graph.get(i).get(j).get(0));
                  //System.out.println (graph.get(i).get(j).get(1));
                  ++j;
          }
          j = 0;
          ++i;
          lineSc.close();
      }
      sc.close();
  
  }
  </code></pre>
  
  <p>Here is the code I have used for retrieving which does not work well</p>
  
  <pre><code>    for (int i = 0; i &lt; N; ++i) {
          Integer minLen = graph.get(i).get(0).get(LI);
          System.out.println (minLen);
          Integer choosenEdge = 0;
          for (int j = 0; j &lt; graph.get(i).size(); ++j) {
              ArrayList&lt;Integer&gt; tmpArr = graph.get(i).get(j);
              System.out.print(tmpArr.get(LI) + "  " + minLen); //Wrong Output
              if (minLen &gt; tmpArr.get(LI))
              {
                  minLen = tmpArr.get(LI);
                  choosenEdge = graph.get(i).get(j).get(EI);
                  System.out.println (choosenEdge); // Wrong Output
              }
  
          }
  
      }
  </code></pre>