22 lines
704 B
Java
22 lines
704 B
Java
// concurrent/CompletableApply.java
|
|
// (c)2016 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.
|
|
import java.util.concurrent.*;
|
|
|
|
public class CompletableApply {
|
|
public static void main(String[] args) {
|
|
CompletableFuture<Machina> cf =
|
|
CompletableFuture.completedFuture(
|
|
new Machina(0));
|
|
CompletableFuture<Machina> cf2 =
|
|
cf.thenApply(Machina::work);
|
|
CompletableFuture<Machina> cf3 =
|
|
cf2.thenApply(Machina::work);
|
|
CompletableFuture<Machina> cf4 =
|
|
cf3.thenApply(Machina::work);
|
|
CompletableFuture<Machina> cf5 =
|
|
cf4.thenApply(Machina::work);
|
|
}
|
|
}
|