title: Writing HashMap contents to the file
body: <p>I have a <code>HashMap&lt;Integer, Integer&gt;</code>. I write its content to the file, so each line of it contains <code>hashmapKey:::hashmapValue</code>. This is how I do it now:</p>
  
  <pre><code>List&lt;String&gt; mLines = new ArrayList&lt;String&gt;();
  mHashMap.forEach((key, value) -&gt; mLines.add(key + DATA_SEPARATOR + value));
  Files.write(mOutputPath, mLines, StandardCharsets.UTF_8);
  </code></pre>
  
  <p>I very doubt that I need to copy entire <code>HashMap</code> to the list of strings, I am sure it will give me performance issues when working with big amounts of data. My question is: how can I write <code>HashMap</code> contents to the file using Java 8 avoiding copying values in another list?</p>