title: Java 8 stream map to list of keys sorted by values
body: <p>I have map <code>Map&lt;Type, Long&gt; countByType</code> and I want to have a list which has sorted (min to max) keys by their corresponding values. My try is:</p>
  
  <pre><code>countByType.entrySet().stream().sorted().collect(Collectors.toList());
  </code></pre>
  
  <p>however this just gives me a list of entries, how can I get a list of types, without losing the order?</p>