title: Does there exist a mutable URL/URI object in Java?
body: <p>I have a URL as a String and I'm looking to perform various modifications to it. Specifically, I need to modify values in the query string if they already exist, and, if they don't, to create them. </p>
  
  <p>It would seem to me that there should already be an existing class that I can construct with my URL as a String that would split the URL into its constituent components and allow me to modify each component individually. In the case of the query string, it should be possible to address it as a Map, modify it, then toString the URL object to get back the modified URL.</p>
  
  <p>Java has a <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html" rel="noreferrer">URL class</a> but it seems extremely limited - they query string is treated as a String, not a Map, and the only way to modify it is to call <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#set%28java.lang.String,%20java.lang.String,%20int,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%29" rel="noreferrer">set</a> and specify all the components of the URL instead of just setting the component I want to set. Are there better alternatives out there? I'd prefer something within the standard java/javax packages, if possible, but I recognize that as unlikely.</p>