Skip to content

Commit d2b66c3

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 4833329 + 6cc2d1f commit d2b66c3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository contains all code samples from the Java 8 related posts of my [b
66
- [Java 8 Tutorial](http://winterbe.com/posts/2014/03/16/java-8-tutorial/)
77
- [Java 8 Stream Tutorial](http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/)
88
- [Java 8 Nashorn Tutorial](http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/)
9+
- [Java 8 API by Example: Strings, Numbers, Math and Files](http://winterbe.com/posts/2015/03/25/java8-examples-string-number-math-files/)
910
- [Avoid Null Checks in Java 8](http://winterbe.com/posts/2015/03/15/avoid-null-checks-in-java/)
1011
- [Fixing Java 8 Stream Gotchas with IntelliJ IDEA](http://winterbe.com/posts/2015/03/05/fixing-java-8-stream-gotchas-with-intellij-idea/)
1112
- [Using Backbone.js with Java 8 Nashorn](http://winterbe.com/posts/2014/04/07/using-backbonejs-with-nashorn/)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)