cast List<Object> to List<Map<String, Object>>
<p>I should know this, but I can't understand this for some reason.</p>

<p>Why can I not cast a List of Objects  <code>List&lt;Object&gt;</code> to a List of Maps <code>List&lt;Map&lt;String, Object&gt;&gt;</code>? Every object in the list is an object of type <code>Map&lt;String, Object&gt;</code>, so why is the casting not possible?</p>

<p>What I can do is create a <code>new ArrayList&lt;Map&lt;String, Object&gt;&gt;();</code> and iterate over the list and add each item with a cast. </p>

<pre><code>List&lt;Object&gt; dataList;
..
//Why doesn't this work?
List&lt;Map&lt;String, Object&gt;&gt; rxData = (List&lt;Map&lt;String, Object&gt;&gt;)dataList;

//This works, but is there a better way?
rxData = new ArrayList&lt;Map&lt;String, Object&gt;&gt;();
for (Object data : dataList) {
    rxData.add((Map&lt;String, Object&gt;)data);
}
</code></pre>