Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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<>();
        if (tasks != null) {
            for (Callable<V> callable : tasks) {
                futures.add(ecs.submit(callable));
            }
        }
        return futures;
    }
}