title: Unknown data type declaration
body: <p>I have a class which holds a list inside a list, and its declared as type String, but i no longer know that its a string.</p>
  
  <pre><code>private ArrayList&lt;List&lt;String&gt;&gt; table;
  table = new ArrayList&lt;List&lt;String&gt;&gt;();
  table.add(new ArrayList&lt;String&gt;()); //is possible
  table.add(new ArrayList&lt;Integer&gt;()); //not possible
  </code></pre>
  
  <p>But now the nested list could either be string or integer. How can i fix that? I also can't declare Object must either be string or integer</p>
  
  <p>Also can a single Arraylist hold both ints and strings without declaring as objects?</p>
  
  <p>Edit: It seems you guys are debating the right answer. I will insight why i chose Vikdor answer. </p>
  
  <p>My job is to load a csv, and then user types in command to define each column as string or int. My table class has a private instance variable, and has methods which adds the values. Doing it in Vikdor way makes performing operations on table very easy where i want to merge two table or sort. It will also prevent user from inputting non string or int through an exception. </p>