title: JAVA Remove And Write Key And Value In YAML FILE
body: <p>1- I Want To parse my yaml file with Java, but this method writes the key each time I execute I need to remove before writing to avoid duplicated entry please help</p>
  
  <p>the content of my yaml file.yaml </p>
  
  <pre><code>dataPrerequis:
  codeClient: 12345df
  codeClient: 12345d  
  </code></pre>
  
  <p>the methode:</p>
  
  <pre><code>public  static void getTestDumpWriter(String yamlFile,String key1,String 
  value1) throws IOException { 
      Map&lt;String, Object&gt; data = new HashMap&lt;String, Object&gt;();
       data.put(key1, value1);
       DumperOptions options = new DumperOptions();
       options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
       options.setSplitLines(`enter code here`false);
       Yaml yaml = new Yaml(options);
       BufferedWriter writer = 
              new BufferedWriter(new FileWriter(yamlFile, true));
       yaml.dump(data, writer); 
       }
  </code></pre>