package speiger.src.coreengine.utils.tasks;

import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class ThreadUtils
{
	public static void join(List<Future<?>> futures) {
		for(int i = futures.size() -1;i>=0;i--) {
			Future<?> future = futures.get(i);
			if(future.isDone()) continue;
			try { future.get(); }
			catch(InterruptedException | ExecutionException e) { }
		}
	}
	
	public static void join(Future<?>...futures) {
		for(int i = futures.length -1;i>=0;i--) {
			Future<?> future = futures[i];
			if(future.isDone()) continue;
			try { future.get(); }
			catch(InterruptedException | ExecutionException e) { }
		}
	}
}