title: Best way to execute simple async task in Java?
body: <p>I want to asynchronously invoke a function which does something separately from main thread. I'm new in Java concurrency, so i ask what is the best way to perform action like this:</p>
  
  <pre><code>for(File myFile : files){
      MyFileService.resize(myfile)  &lt;--- this should be async
  }
  </code></pre>
  
  <p>The while loop goes on while function <code>MyFileService.resize</code> works in background with each of my files in collection.</p>
  
  <p>I heard that CompletionStage from Java8 could be good way to do it.
  What is the best way?</p>