小编Har*_*rsh的帖子

在期货清单上流式传输的最有效方式

我通过流式传输对象列表来调用异步客户端方法.该方法返回Future.

迭代调用后返回的Futures列表的最佳方法是什么(以便处理那些首先出现的Future)?

注意:异步客户端仅返回Future not CompletableFuture.

以下是代码:

List<Future<Object>> listOfFuture = objectsToProcess.parallelStream()
    .map((object) -> {
        /* calling an async client returning a Future<Object> */ })
    .collect(Collectors.toList());
Run Code Online (Sandbox Code Playgroud)

java concurrency future java-8 completable-future

6
推荐指数
1
解决办法
4363
查看次数

标签 统计

completable-future ×1

concurrency ×1

future ×1

java ×1

java-8 ×1