Here you can find the source of submitTasks(ExecutorCompletionService
public static <V> List<Future<V>> submitTasks(ExecutorCompletionService<V> ecs, Iterable<Callable<V>> tasks)
//package com.java2s; //License from project: Apache License import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Future; public class Main { public static <V> List<Future<V>> submitTasks(ExecutorCompletionService<V> ecs, Iterable<Callable<V>> tasks) { List<Future<V>> futures = new LinkedList<Future<V>>(); if (tasks != null) { for (Callable<V> callable : tasks) { futures.add(ecs.submit(callable)); }//from w w w . j a va 2 s . c o m } return futures; } }