title: Replacing stream collect in Kotlin native solution
body: <p>I am currently using a Kotlin function to extract a map out of a Json structure with key value pairs.</p>
  
  <p>The JSON used to build the map is contains a label and a value:</p>
  
  <pre><code>"values": [
  {
    "label": "Email",
    "value": "email"
  },
  {
    "label": "Social media",
    "value": "socialMedia"
  },
  {
    "label": "Word of mouth",
    "value": "wordOfMouth"
  },
  {
    "label": "Newspaper",
    "value": "newspaper"
  }
  ],
  </code></pre>
  
  <p>The JSON "label" should become the key of the map and the "value" its value.</p>
  
  <p>This is the code used to extract and convert the JSON to a map using Java 8's stream collect method.</p>
  
  <pre><code>fun extractValue(jsonNode: JsonNode?): Map&lt;String, String&gt; {
      val valuesNode = jsonNode?.get("values") ?: mapper.createArrayNode()
      return valuesNode.map { Pair(it.get("label")?.asText() ?: "", it.get("value")?.asText() ?: "") }
              .stream().collect({ HashMap&lt;String, String&gt;()}, { m, p -&gt; m.put(p.first, p.second) } , { m, p -&gt; })
  }
  </code></pre>
  
  <p>How do you write the part with stream().collect in idiomatic Kotlin? What alternatives do you have to replace </p>
  
  <blockquote>
    <p>stream().collect()</p>
  </blockquote>
  
  <p>in this specific case?</p>