You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1fab573
Browse filesBrowse the repository at this point in the historyBrowse files
Basically provide a call back to the future itself, so that as soon the result is available it can react to it by triggering those callbacks. In ```future``` the method ```get``` is blocking (waits indefinitely for the result). In completableFuture the current thread is not blocked.
150
+
Similar to JavaScript promises. Multiple async tasks can be chained (performed one after another on separate thread). Better alternative to ```future``` where the method ```get``` is blocking (waits indefinitely for the result). In completableFuture the current thread is not blocked. Each task is executed once previous task is completed.
162
151
163
152
Also, the program itself becomes more readable.
164
153
@@ -170,7 +159,7 @@ Also, the program itself becomes more readable.
170
159
.thenRun(() ->System.out.println(“done”)));
171
160
```
172
161
173
-
So when you trigger this, it immediately returns the CompletableFuture, and you can check its methods below to check status and such.
162
+
So when you trigger this, it immediately returns the CompletableFuture instance, which can be used to check its status and such.
174
163
175
164
**Massive API**
176
165
@@ -180,35 +169,9 @@ So when you trigger this, it immediately returns the CompletableFuture, and you
180
169
- cancel()
181
170
- isDone()
182
171
183
-
**Producer of the CompletableFuture**
184
-
185
-
So you return a new CompletableFuture immediately, and keep its reference so that while processing and after processing you can trigger the right methods on it (complete)
0 commit comments