title: converting hashmap to stringarray
body: <p>I am trying to convert a hashmap into an array, that I can put in a created string array. I however get java.lang. I have typeconverted my drinkar.keySet().toArray() to String[], but it will still not work. </p>
  
  <pre><code>public String[] receiveArrayList(){
  
  String[] list = new String[0];
  
      try {
          ois = new ObjectInputStream(socket.getInputStream());
          drinkar = (HashMap&lt;String, ArrayList&lt;String&gt;&gt;) (ois.readObject());
          System.out.println(drinkar);
  
          System.out.println(Arrays.toString(drinkar.keySet().toArray()));
          list = (String[]) (drinkar.keySet().toArray());
  
          for(int i = 0; i &lt; list.length; i++){
              System.out.println(list);
          }
  
  
      } catch (ClassNotFoundException ex) {
          System.out.println(ex);
      } catch (IOException ex) {
          System.out.println(ex);
      }
      return list;
  
  }
  </code></pre>