Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
@param tasks the collection of tasks
@param < T> the type of the values returned from the tasks
@return the result returned by one of the tasks
@throws InterruptedException if interrupted while waiting
@throws NullPointerException if tasks or any element tasksubject to execution is {@code null}
@throws IllegalArgumentException if tasks is empty
@throws ExecutionException if no task successfully completes
@throws RejectedExecutionException if tasks cannot be scheduledfor execution
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.