title: Comparing URLs with parameters in Java
body: <p>These two urls should be the same:</p>
  
  <pre><code>http://localhost?asdf=1&amp;qwer=2
  http://localhost?qwer=2&amp;asdf=1
  </code></pre>
  
  <p>But using 'equals()' from the URL class, I get that they're different. How can I compare them?</p>
  
  <p><em>EDIT: Some background on this question</em></p>
  
  <p>I'm creating a Selenium test for some url mapping. I have old url, url it should get mapped to and the actual url. I need to compare the should-be url to the actual url. List of urls is created by client. Urls with the same parameters and values are considered valid if the list of parameters is the same, and they all have the right values (order of those parameters is irrelevant)</p>