title: How do I execute two tasks simultaneously and wait for the results in Groovy?
body: <p>I have a large processing task which I believe is ripe for being made more efficient with concurrency and parallelism.</p>
  
  <p>I had a look at the GPars docs and I found them quite confusing so I hope people here can help.</p>
  
  <p>The first task I would like to do in parallel currently looks like this:</p>
  
  <pre><code>def providerOneProgrammes = providerOneProgrammeService.getProgrammes(timeWindow)
  def providerTwoProgrammes = providerTwoProgrammeService.getProgrammes(timeWindow)
  </code></pre>
  
  <p>both return a list of objects and both can be run in parallel.</p>
  
  <p>I would like to execute them together and then wait for them to finish before processing the return lists (I will then look for matches between the lists but I'll come to that later).</p>
  
  <p>Thanks</p>
  
  <p>Rakesh</p>