Created
May 1, 2018 11:40
-
-
Save noriyukitakei/f4f4cabb765c0946989e853983832fff to your computer and use it in GitHub Desktop.
Javaの並列処理いろいろ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package thread.sample; | |
import java.util.concurrent.CompletableFuture; | |
public class ComletableFutureSample2 { | |
public static void main(String[] args) { | |
// 戻り値が固定で決まっているときは、CompletableFutureのstaticメソッドの | |
// completedFutureを使います。 | |
CompletableFuture<?> cf = CompletableFuture.completedFuture("hoge"); | |
cf.whenComplete((ret, err) -> { | |
System.out.println(ret); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment