title: Snakeyaml - How to have custom control on the flow style
body: <p>I am trying to create a YAML file in java with snakeyaml, and I have trouble obtaining the format I need. Some of the children are in the correct format when using <code>DumperOptions.FlowStyle.BLOCK</code>, while other parts are in the correct format when using the default <code>DumperOptions.FlowStyle.AUTO</code>. Here is a minimal example of what I mean: </p>
  
  <pre><code>Map&lt;String,Integer&gt; children1 = new LinkedHashMap();
  children1.put("Criteria-1", 2);
  children1.put("Criteria-2",1);
  
  List&lt;List&lt;Object&gt;&gt; children2 = new ArrayList&lt;&gt;();
  List&lt;Object&gt; list = new ArrayList&lt;&gt;();
  list.add("Criteria-1");
  list.add("Criteria-2");
  list.add(new Integer(1));
  children2.add(list);
  
  Map&lt;String,Object&gt; map = new LinkedHashMap();
  map.put("Version",2.0);
  map.put("Parent-1",children1);
  map.put("Parent-2",children2);      
  
  //Style 1 - AUTO - Correct format for Parent-2
  Yaml yaml1 = new Yaml();
  String style1 = yaml1.dump(map);
  System.out.println(style1);
  
  //Style 2 - BLOCK - Correct format for Parent-1
  DumperOptions options = new DumperOptions();
  options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
  Yaml yaml2 = new Yaml(options);
  String style2 = yaml2.dump(map);
  System.out.println(style2);
  </code></pre>
  
  <p>The first option outputs this, which gives the correct format for Parent-2 but not for Parent-1:</p>
  
  <pre><code>Version: 2.0
  Parent-1: {Criteria-1: 2, Criteria-2: 1}
  Parent-2:
  - [Criteria-1, Criteria-2, 1]
  </code></pre>
  
  <p>The second option outputs this, which gives the correct format for Parent-1 but not for Parent-2:</p>
  
  <pre><code>Version: 2.0
  Parent-1:
    Criteria-1: 2
    Criteria-2: 1
  Parent-2:
  - - Criteria-1
    - Criteria-2
    - 1
  </code></pre>
  
  <p>The output I need is:</p>
  
  <pre><code>Version: 2.0
  Parent-1:
    Criteria-1: 2
    Criteria-2: 1
  Parent-2:
  - [Criteria-1, Criteria-2, 1]
  </code></pre>
  
  <p>The actual file contains anchors and aliases, so I cannot dump the yaml in two times. Is there a way to custom which parts of the map should be <code>FLOW</code> and which should be <code>BLOCK</code>? Should I use another way to construct the map?</p>