title: Java: How to create an array of Map<String,Object> objects
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/217065/cannot-create-an-array-of-linkedlists-in-java">Cannot create an array of LinkedLists in Java&hellip;?</a>  </p>
  </blockquote>
  
  
  
  <p>I want to call this method:</p>
  
  <pre><code>executeBatch(Map&lt;String,Object&gt;[] batch) 
  </code></pre>
  
  <p>But for the life of me I can't figure out how to create an array of <code>Map&lt;String,Object&gt;[]</code></p>
  
  <p>I get the error "Can create a generic array of HashMap" when I try <code>HashMap&lt;String,Object&gt;[] params = new HashMap&lt;String,Object&gt;[20000];</code></p>
  
  <p>I also failed at attempting to cast an <code>ArrayList.toArray()</code> to a <code>HashMap&lt;String,Object&gt;[]</code></p>