title: Convert query string to map in scala
body: <p>I have a query string in this form:</p>
  
  <pre><code>val query = "key1=val1&amp;key2=val2&amp;key3=val3
  </code></pre>
  
  <p>I want to create a map with the above key/value pairs. So far I'm doing it like this:</p>
  
  <pre><code>//creating an iterator with 2 values in each group. Each index consists of a key/value pair
  val pairs = query.split("&amp;|=").grouped(2)
  
  //inserting the key/value pairs into a map
  val map = pairs.map { case Array(k, v) =&gt; k -&gt; v }.toMap
  </code></pre>
  
  <p>Are there any problems with doing it like I do? If so, is there some library I could use to do it?</p>