title: Storing different types of elements in a List in Java
body: <p>I'm trying to develop a general table loader which schema is known at runtime.  This requires having a class which contains a list of different types of elements and supports various get and set method such as <code>getInt(int index)</code>, <code>asString(int index)</code>, <code>asStringList(int index)</code>. The types of elements I consider are <code>Integer</code>, <code>Double</code>, <code>String</code>, and <code>List&lt;Integer&gt;</code>, <code>List&lt;Double&gt;</code> and <code>List&lt;String&gt;</code>.  The actual type of each element is known in run time, and I will store them in a List describing its schema for further processing.</p>
  
  <p>My question is: should I store such list of elements in <code>List&lt;Object&gt;</code> or <code>List&lt;? extends Object&gt;</code>? or is there better way to implement such class?</p>