package com.jay.monitor.data.server.factory.thread;

import java.util.concurrent.CompletableFuture;

/**
 * @Module TODO
 * @Description TODO
 * @Author liukaixiong
 * @Date 2020/11/27 14:57
 */
public class DefaultThreadFactory {
    public static int print(int index) {
        int result = index * 100;
        System.out.println(index + "处理完消费:" + result);
        return result;
    }

    public static void main(String[] args) {
        CompletableFuture<Integer> list[] = new CompletableFuture[10];
        for (int i = 0; i < 10; i++) {
            int finalI = i;
            CompletableFuture<Integer> future = CompletableFuture.supplyAsync(() -> {
                int print = DefaultThreadFactory.print(finalI);
                return print;
            });
            list[i] = future;
        }
//        List<Integer> numList = Arrays.asList(1, 2, 3, 4, 5, 6);
//        numList.stream().parallel().reduce()
    }
}
