title: How to iterate over MultivaluedMap and extract the key and its corresponding first value?
body: <p>Here is my code its my first attempt . But what is the correct way to do this.</p>
  
  <pre><code>    private Map&lt;String,String&gt; prepareParameters(MultivaluedMap&lt;String, String&gt; queryParameters) {
  
      Map&lt;String,String&gt; parameters = new HashMap&lt;String,String&gt;();
      for (Map.Entry&lt;String,List&lt;String&gt;&gt; e : queryParameters.entrySet()) {
          parameters.put(e.getKey(), e.getValue().get(0));
      } 
  </code></pre>