title: Is there a Java method that encodes a collection of parameters as a URL query component?
body: <p>Is there a widely-used Java library that does something like what <a href="http://api.dojotoolkit.org/jsdoc/1.3/dojo.objectToQuery" rel="noreferrer">dojo.objectToQuery()</a> does? E.g. (assuming the use of HttpCore's <a href="http://hc.apache.org/httpcomponents-core/httpcore/apidocs/index.html" rel="noreferrer">HttpParams</a> object, but any key-value mapping will do):</p>
  
  <pre><code>HttpParams params = new BasicHttpParams()
      .setParameter("foo", "bar")
      .setParameter("thud", "grunt");
  UnknownLibrary.toQueryString(params);
  </code></pre>
  
  <p>should yield "foo=bar&amp;thud=grunt".</p>
  
  <p>I know it's not hard to write but it seems like it should have already been written. I just can't find it.</p>