title: How to convert a HashMap to a K/V-String in Java 8 with Streams
body: <p>I want to create a string of the key value pairs of my <code>HashMap&lt;String, String&gt; m</code> as fast as possible.</p>
  
  <p>I tried:</p>
  
  <pre><code>StringBuffer buf = new StringBuffer();
  buf.append("[");
  for (String key : m.keySet()) {
     buf.append(key);
     buf.append("=");
     buf.append(m.get(key));
     buf.append(";");
  }
  buf.append("]");
  </code></pre>
  
  <p>With Java8 I tried:</p>
  
  <pre><code>m.entrySet().stream()
              .map(entry -&gt; entry.getKey() + " = " + entry.getValue())
              .collect(Collectors.joining("; " , "[" , "]"));
  </code></pre>
  
  <p>Is there any faster, better code to do that?
  It seems to be costly to append the keys and Values in the map function, doesn't it?</p>