title: Flatten lists in map into single list
body: <p>I have defined a <code>map</code> like below and it has lists of strings as values</p>
  
  <pre><code>Map&lt;Integer,List&lt;String&gt;&gt; MapOf_words_arrays = new HashMap&lt;Integer,List&lt;String&gt;&gt;();
  </code></pre>
  
  <p>I need to get the values of above Map in to one string array  (e.g shown below) , .</p>
  
  <pre><code>["dog","cat"]
  ["book","pen","phone","waterbottle"]
  .
  .
  .etc
  </code></pre>
  
  <p>I'm using the below statement</p>
  
  <pre><code>String wordlists = MapOf_words_arrays.values().toArray(new String[0]);
  </code></pre>
  
  <p>but I'm getting an error</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ArrayStoreException:
    java.util.ArrayList$SubList
            at java.util.AbstractCollection.toArray(AbstractCollection.java:196)
            at ScrapePages.main(ScrapePages.java:98)</p>
  </blockquote>
  
  <p>Can anybody help me out here?</p>