Skip to content

Instantly share code, notes, and snippets.

@noriyukitakei
Created May 1, 2018 11:40
Show Gist options
  • Save noriyukitakei/f4f4cabb765c0946989e853983832fff to your computer and use it in GitHub Desktop.
Save noriyukitakei/f4f4cabb765c0946989e853983832fff to your computer and use it in GitHub Desktop.
Javaの並列処理いろいろ
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