1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update completablefuture-intro.md

This commit is contained in:
paigeman 2023-06-12 12:36:52 +08:00 committed by GitHub
parent edaeba482d
commit 5c7206fc8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -418,7 +418,7 @@ assertEquals("hello!world!nice!", completableFuture.get());
**那 `thenCompose()``thenCombine()` 有什么区别呢?**
- `thenCompose()` 可以两个 `CompletableFuture` 对象,并将前一个任务的返回结果作为下一个任务的参数,它们之间存在着先后顺序。
- `thenCompose()` 可以链接两个 `CompletableFuture` 对象,并将前一个任务的返回结果作为下一个任务的参数,它们之间存在着先后顺序。
- `thenCombine()` 会在两个任务都执行完成后,把两个任务的结果合并。两个任务是并行执行的,它们之间并没有先后依赖顺序。
### 并行运行多个 CompletableFuture