Skip to content

Commit 5de72c0

Browse files
author
Bruce Eckel
committed
added return operations
1 parent 65246ae commit 5de72c0

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

concurrent/DualCompletableOperations.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://OnJava8.com for more book information.
55
import java.util.concurrent.*;
6+
import static onjava.CompletableUtilities.*;
67

78
public class DualCompletableOperations {
89
static CompletableFuture<Workable> cfA, cfB;
@@ -17,41 +18,41 @@ static void join() {
1718
}
1819
public static void main(String[] args) {
1920
init();
20-
cfA.runAfterEitherAsync(cfB, () ->
21-
System.out.println("runAfterEither"));
21+
voidr(cfA.runAfterEitherAsync(cfB, () ->
22+
System.out.println("runAfterEither")));
2223
join();
2324

2425
init();
25-
cfA.runAfterBothAsync(cfB, () ->
26-
System.out.println("runAfterBoth"));
26+
voidr(cfA.runAfterBothAsync(cfB, () ->
27+
System.out.println("runAfterBoth")));
2728
join();
2829

2930
init();
30-
cfA.applyToEitherAsync(cfB, w -> {
31+
showr(cfA.applyToEitherAsync(cfB, w -> {
3132
System.out.println("applyToEither: " + w);
3233
return w;
33-
});
34+
}));
3435
join();
3536

3637
init();
37-
cfA.acceptEitherAsync(cfB, w -> {
38+
voidr(cfA.acceptEitherAsync(cfB, w -> {
3839
System.out.println("acceptEither: " + w);
39-
});
40+
}));
4041
join();
4142

4243
init();
43-
cfA.thenAcceptBothAsync(cfB, (w1, w2) -> {
44+
voidr(cfA.thenAcceptBothAsync(cfB, (w1, w2) -> {
4445
System.out.println("thenAcceptBoth: "
4546
+ w1 + ", " + w2);
46-
});
47+
}));
4748
join();
4849

4950
init();
50-
cfA.thenCombineAsync(cfB, (w1, w2) -> {
51+
showr(cfA.thenCombineAsync(cfB, (w1, w2) -> {
5152
System.out.println("thenCombine: "
5253
+ w1 + ", " + w2);
5354
return w1;
54-
});
55+
}));
5556
join();
5657

5758
init();
@@ -79,10 +80,11 @@ public static void main(String[] args) {
7980
*****************
8081
Workable[BW]
8182
Workable[AW]
82-
*****************
8383
runAfterBoth
84+
*****************
8485
Workable[BW]
8586
applyToEither: Workable[BW]
87+
Workable[BW]
8688
Workable[AW]
8789
*****************
8890
Workable[BW]
@@ -91,21 +93,22 @@ public static void main(String[] args) {
9193
*****************
9294
Workable[BW]
9395
Workable[AW]
94-
*****************
9596
thenAcceptBoth: Workable[AW], Workable[BW]
97+
*****************
9698
Workable[BW]
9799
Workable[AW]
98-
*****************
99100
thenCombine: Workable[AW], Workable[BW]
101+
Workable[AW]
102+
*****************
100103
Workable[CW]
101104
anyOf
102-
Workable[DW]
103105
Workable[BW]
106+
Workable[DW]
104107
Workable[AW]
105108
*****************
106109
Workable[CW]
107-
Workable[DW]
108110
Workable[BW]
111+
Workable[DW]
109112
Workable[AW]
110113
*****************
111114
allOf

0 commit comments

Comments
 (0)