We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3fa0dd commit 6cc2d1fCopy full SHA for 6cc2d1f
src/com/winterbe/java8/samples/concurrent/CompletableFuture1.java
@@ -0,0 +1,22 @@
1
+package com.winterbe.java8.samples.concurrent;
2
+
3
+import java.util.concurrent.CompletableFuture;
4
+import java.util.concurrent.ExecutionException;
5
6
+/**
7
+ * @author Benjamin Winterberg
8
+ */
9
+public class CompletableFuture1 {
10
11
+ public static void main(String[] args) throws ExecutionException, InterruptedException {
12
+ CompletableFuture<String> future = new CompletableFuture<>();
13
14
+ future.complete("42");
15
16
+ future
17
+ .thenAccept(System.out::println)
18
+ .thenAccept(v -> System.out.println("done"));
19
20
+ }
21
22
+}
0 commit comments