title: can CompletableFuture be worth when assyncronosly writing in a single xml document from different threads
body: <p>Scenario: I am coding a soap webservice client and I must transform from the webservice response to our internal xml structure. The answer from user perspective must be faster as possible since it is online process (there is no batch at all involved and can be a considered amount of data according to the search criteria. Please, don't suggest pagination or break in more web calls since it is not part of my question). The webservice answer is quite nested and the outcome from my transformation is a very simple structure with just two levels for each item answered in a list:</p>
  
  <pre><code>&lt;myroot&gt;
   &lt;firstelement&gt;some info&lt;/firstelement&gt;
   &lt;secondelement&gt;other info&lt;/secondelement&gt;
   ...
   &lt;100element&gt;another info&lt;/100element&gt;
  &lt;/myroot&gt;
  </code></pre>
  
  <p>Focus of this question: taking advantage of features added in Java 8 regard concurrency for didactic purposes (by new features I mean <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/changes8.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/changes8.html</a>).</p>
  
  <p>I understand that writing from n threads to the same file demands sincronization. From the sample above I guess it shows how simple will be the writing after the transformation process for each one of the 100 object types answered. The big job lies in process the answer which will contain a lot useless fields for us and other fields that impact how we collect other fields but aren't relevant after filtered applied.</p>
  
  <p>I have been reading a lot for the last weeks looking for some way to take advantange of JAVA 8 features (eg. parallalel stream and completeableFuture) to improve the performance of transforming the web service answer about completeableFuture.thenCombine and must of the examples show a concatenation of string or a simple sum of int values and then, as far as I could judge, they are combined. I start to wondering if I am going to correct direction: having two completeFuture writing in the same place (eg. xml document) assuming it I will gain sincronization behind the scene "by grant".</p>