title: NegativeArraySizeException on a HashMap
body: <p>For some reason, my program suddenly throws a <code>NegativeArraySizeException</code> after running for a while. The code that throws it is behind a command, which I've entered before the exception is thrown.</p>
  
  <p>The code I'm using is mostly for debug purposes, and is the following:</p>
  
  <pre><code>final HashMap&lt;String, Integer&gt; busy = new HashMap&lt;&gt;();
  //this map gets filled and emptied in threads
  
  System.out.println("Busy tables: " + Arrays.toString(this.busy.keySet().toArray()));
  System.out.println("Time busy: " + Arrays.toString(this.busy.values().toArray()));
  //map gets read (from the input handler thread)
  </code></pre>
  
  <p>The exception is thrown on the first <code>System.out.println()</code> line, but I can imagine it being thrown on the other one too if it'd continued running.</p>
  
  <p>Could it be some sort of Threading issue or could the cause be somewhere else?</p>
  
  <p>Google gave me (for the first time in ages) no usable results. How can a Set have a negative size anyway?</p>
  
  <p>Edit: The exception:</p>
  
  <pre><code>Exception in thread "Thread-1" java.lang.NegativeArraySizeException
      at java.util.AbstractCollection.toArray(Unknown Source)
      at nl.lolmewn.statsglobal.Main.handleInput(Main.java:61)
      at nl.lolmewn.statsglobal.Main.access$000(Main.java:20)
      at nl.lolmewn.statsglobal.Main$1.run(Main.java:200)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>