title: Java: How do I use the result of the first of multiple threads that complete?
body: <p>I have a problem in Java where I want to spawn multiple concurrent threads simultaneously. I want to use the result of whichever thread/task finishes first, and abandon/ignore the results of the other threads/tasks. I found a similar question for just <a href="https://stackoverflow.com/questions/19480162/java-threads-close-other-threads-when-first-thread-completes">cancelling slower threads</a> but thought that this new question was different enough to warrant an entirely new question.</p>
  
  <p>Note that I have included an answer below based what I considered to be the best answer from this similar question but changed it to best fit this new (albeit similar) problem. I wanted to share the knowledge and see if there is a better way of solving this problem, hence the question and self-answer below.</p>