title: Merging two Config.yml Files in Java?
body: <p>While programming my bukkit plugin, i realized that i needed to have my own config file so i can add comments into the file. I also needed to be able to update the config (if it has been created and is old).</p>
  
  <p>I had also recently finished a simple jQuery plugin, where I used <code>jQuery.extend</code> and i merged two settings arrays. I wanted to know if this was possible in java with config files.</p>
  
  <p><strong>My Question:</strong> </p>
  
  <p><code>Is there a way i can merge the new default config with the one the user already has? (Removing non-needed values or changing the names of the same strings)</code></p>
  
  <p><strong>An Explanation of the question:</strong></p>
  
  <p>Here is an example config.yml i might have:</p>
  
  <pre><code># Comment here....
  
  myString: defaultString 
  
  myBool: false
  
  myList: 
    - Value
    - Value 2
  </code></pre>
  
  <p>Pretty simple. Lets say this is my default config. The plugin has copied this config (if it is not already there) inside the plugin folder. But, this brings up one issue:</p>
  
  <p><code>What if i need to update my config? (Add/Remove a bool, string, etc.)</code></p>
  
  <p>One day, i say "I no longer need that boolean <code>myBool</code>". I remove it from the default config.yml and the config looks something like this:</p>
  
  <pre><code># Comment here....
  
  myString: defaultString 
  
  myList: 
    - Value
    - Value 2
  </code></pre>
  
  <p>Or, i might need to add an extra string <code>myNewString</code>:</p>
  
  <pre><code># Comment here....
  
  myString: defaultString
  myNewString: string 
  
  myList: 
    - Value
    - Value 2
  </code></pre>
  
  <p>If i rewrite the config yml to my new "Default" config file, i will lose all the user's configuration settings. </p>
  
  <p><code>Is there a way i can merge the new default config with the one the user already has and just add the new string with the default values?</code></p>