title: Accessing Data From ArrayList
body: <p>I m working on populating a list dynamically with dynamic rows and columns and showing them in UI.  All have been done accurately but i m unable to get value from a specified row and column e.g. row 4 and column 3.  Code is as under:-</p>
  
  <pre><code>    public LiveRangeService() {
      tableData = new ArrayList&lt; Map&lt;String, ColumnModel&gt; &gt;();
  
      //Generate table header.
      tableHeaderNames = new ArrayList&lt;ColumnModel&gt;();
      for (int j = 0; j &lt; 10; j++) {
            tableHeaderNames.add(new ColumnModel("header "+j, " col:"+ String.valueOf(j+1)));
      }
  
      //Generate table data.
      for (int i = 0; i &lt; 8; i++) {
          Map&lt;String, ColumnModel&gt; playlist = new HashMap&lt;String, ColumnModel&gt;();
          for (int j = 0; j &lt; 10; j++) {
              playlist.put(tableHeaderNames.get(j).key, new ColumnModel(tableHeaderNames.get(j).key,"row:" + String.valueOf(i+1) +" col:"+ String.valueOf(j+1)));
          }
          tableData.add(playlist);
      }
      try {
          System.out.println( "Table Data Size " + tableData.size() );
          System.out.println( "Value Of Row 1 Col 2: " + tableData.get(1).get(2) );
      } catch (Exception e) {
          System.out.println( "Error!! " + e.getMessage() );
      }
  }
  </code></pre>
  
  <p>may some body pls help me in understanding this chunk of code.  Error occurs on the following line:-</p>
  
  <pre><code>            System.out.println( "Value Of Row 1 Col 2: " + tableData.get(1).get(2) );
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/1jzUg.png" rel="nofollow noreferrer">the result shown on page</a></p>