title: Add elements in multidimensional ArrayList in Java
body: <p>I want to store some values (actually a message) using list in Java. I want to store something like:</p>
  
  <pre><code>{user1, message, user2, time}
  {user1, message, user4, time}
  {user3, message, user1, time} 
  </code></pre>
  
  <p>I have declared an arraylist like this:</p>
  
  <pre><code>public List&lt;List&lt;String&gt;&gt; message = new ArrayList&lt;List&lt;String&gt;&gt;();
  </code></pre>
  
  <p>How can I add values in this list and how can I get a specific row (let's say the second row) of this list?</p>
  
  <p>I've tried:</p>
  
  <pre><code>    message.get(0).add(msg, target,time);
  </code></pre>
  
  <p>but I get an error:</p>
  
  <blockquote>
    <p>"The method add(String) in the type List is not applicable for
    the arguments (String, String, Integer)"</p>
  </blockquote>