织梦网站首页目录在哪里,自己编写的网站如何放到wordpress,ui培训完找工作没人要,基于wordpress学校系统当几个阶段中的一个完成#xff0c;创建一个完成的阶段
下面的例子演示了当任意一个CompletableFuture完成后#xff0c; 创建一个完成的CompletableFuture.
待处理的阶段首先创建#xff0c; 每个阶段都是转换一个字符串为大写。因为本例中这些阶段都是同步地执行(thenAp…当几个阶段中的一个完成创建一个完成的阶段
下面的例子演示了当任意一个CompletableFuture完成后 创建一个完成的CompletableFuture.
待处理的阶段首先创建 每个阶段都是转换一个字符串为大写。因为本例中这些阶段都是同步地执行(thenApply), 从anyOf中创建的CompletableFuture会立即完成这样所有的阶段都已完成我们使用whenComplete(BiConsumer? super Object, ? super Throwable action)处理完成的结果。
static void anyOfExample() {StringBuilder result new StringBuilder();List messages Arrays.asList(a, b, c);ListCompletableFuture futures messages.stream().map(msg - CompletableFuture.completedFuture(msg).thenApply(s - delayedUpperCase(s))).collect(Collectors.toList());CompletableFuture.anyOf(futures.toArray(new CompletableFuture[futures.size()])).whenComplete((res, th) - {if(th null) {assertTrue(isUpperCase((String) res));result.append(res);}});assertTrue(Result was empty, result.length() 0);
}