title: How to convert arraylist to an array?
body: <p>I have this ArrayList in Java -</p>
  
  <pre><code>List&lt;Map&lt;String, Object&gt;&gt; list = new ArrayList&lt;Map&lt;String, Object&gt;&gt;();
  </code></pre>
  
  <p>To convert it to an array I invoke <code>list.toArray()</code> method, but it returns <code>Object[]</code>. This is not what I want. I want <code>Map&lt;String, Object&gt;[]</code>.</p>
  
  <p>I know about <code>List.toArray(T[] a);</code>
  It doesn't work with parameterized types.</p>
  
  <p>The method signature of batchUpdate method in Spring framework is this -</p>
  
  <pre><code>int[] org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.batchUpdate(String sql, Map&lt;String, ?&gt;[] batchValues)
  </code></pre>
  
  <p>If it is not possible to create array of Map objects why is Spring using it? And how are we supposed to use this method then?</p>