title: HashSet order and difference with JDK 7 / 8
body: <p>This is a two part question:</p>
  
  <ol>
  <li>Does HashSet implement some hidden ordering mechanic or it just, to quote the documentation:<code>It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time.</code> tells me that the order MIGHT change sometimes in the future and/or depending on memory usage?</li>
  <li>Why am I getting completely different 'ordering' (dare I say) when I switch between JDKs?</li>
  </ol>
  
  <p>Take this example:</p>
  
  <pre><code>for (int i = 0; i &lt; 1000; i++) {
          Set&lt;String&gt; stringSet = new HashSet&lt;&gt;();
          stringSet.add("qwe");
          stringSet.add("rtz");
          stringSet.add("123");
          stringSet.add("qwea");
          stringSet.add("12334rasefasd");
          stringSet.add("asdxasd");
          stringSet.add("arfskt6734");
          stringSet.add("123121");
          stringSet.add("");
          stringSet.add("qwr");
          stringSet.add("rtzz");
          stringSet.add("1234");
          stringSet.add("qwes");
          stringSet.add("1234rasefasd");
          stringSet.add("asdxasdq");
          stringSet.add("arfskt6743");
          stringSet.add("123121 ");
          stringSet.add(" ");
          System.out.println(stringSet);
      }
  </code></pre>
  
  <p>will, no matter how many times I run it, produce the following output:</p>
  
  <p>JDK 7: <code>[,  , 123, qwea, asdxasdq, qwe, qwr, 123121 , arfskt6743, 1234rasefasd, qwes, rtz, rtzz, 1234, 12334rasefasd, asdxasd, arfskt6734, 123121]</code></p>
  
  <p>JDK 8: <code>[,  , qwes, arfskt6743, asdxasdq, 123121, 123121 , arfskt6734, qwr, 123, 1234, qwea, rtzz, rtz, 12334rasefasd, 1234rasefasd, qwe, asdxasd]</code></p>
  
  <p>Obviously, the empty string and the whitespace-only-string are leading the way both times, but the rest of it is completely different.</p>