title: Convert ArrayList<String> to ArrayList<Object>
body: <p>If type <code>B</code> can be generalised to type <code>A</code>, how do I convert a <code>List&lt;B&gt;</code> to a <code>List&lt;A&gt;</code>? Do I need a loop like:</p>
  
  <pre><code>List&lt;A&gt; newList=new ArrayList&lt;A&gt;();
  for(B t:oldList) newList.add(t);
  </code></pre>
  
  <p>Edit: I don't know the word for it, but I mean to say an object of type <code>B</code> can be casted to an object of type <code>A</code> (like <code>B implements A</code>).</p>
  
  <p>Edit2: It appears that the constructor also works:</p>
  
  <pre><code>List&lt;A&gt; newList=new ArrayList&lt;A&gt;(oldList);
  </code></pre>
  
  <p>However, I wanted a more efficient approach rather than just copying the list.</p>