title: How to convert Map to List in Java 8
body: <p>How to convert a <code>Map&lt;String, Double&gt;</code> to <code>List&lt;Pair&lt;String, Double&gt;&gt;</code> in Java 8?</p>
  <p>I wrote this implementation, but it is not efficient</p>
  <pre><code>Map&lt;String, Double&gt; implicitDataSum = new ConcurrentHashMap&lt;&gt;();
  //....
  List&lt;Pair&lt;String, Double&gt;&gt; mostRelevantTitles = new ArrayList&lt;&gt;();
  implicitDataSum.entrySet()
                 .stream()
                 .sorted(Comparator.comparing(e -&gt; -e.getValue()))
                 .forEachOrdered(e -&gt; mostRelevantTitles.add(new Pair&lt;&gt;(e.getKey(), e.getValue())));
  
  return mostRelevantTitles;
  </code></pre>
  <p>I know that it should works using <code>.collect(Collectors.someMethod())</code>. But I don't understand how to do that.</p>