1 Star 2 Fork 1

csbooks/OnJava8-Code

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
CompletableUtilities.java 802 Bytes
Copy Edit Raw Blame History
Bruce Eckel authored 2017-01-03 06:22 +08:00 . Separated into their own utility class
// concurrent/CompletableUtilities.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
package onjava;
import java.util.concurrent.*;
public class CompletableUtilities {
// Get and show value stored in a CF:
public static void showr(CompletableFuture<?> c) {
try {
System.out.println(c.get());
} catch(InterruptedException
| ExecutionException e) {
throw new RuntimeException(e);
}
}
// For CF operations that have no value:
public static void voidr(CompletableFuture<Void> c) {
try {
c.get(); // Returns void
} catch(InterruptedException
| ExecutionException e) {
throw new RuntimeException(e);
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/javabook/OnJava8-Code.git
git@gitee.com:javabook/OnJava8-Code.git
javabook
OnJava8-Code
OnJava8-Code
master

Search