33// We make no guarantees that this code is fit for any purpose.
44// Visit http://OnJava8.com for more book information.
55import java .util .concurrent .*;
6+ import static onjava .CompletableUtilities .*;
67
78public 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*****************
8081Workable[BW]
8182Workable[AW]
82- *****************
8383runAfterBoth
84+ *****************
8485Workable[BW]
8586applyToEither: Workable[BW]
87+ Workable[BW]
8688Workable[AW]
8789*****************
8890Workable[BW]
@@ -91,21 +93,22 @@ public static void main(String[] args) {
9193*****************
9294Workable[BW]
9395Workable[AW]
94- *****************
9596thenAcceptBoth: Workable[AW], Workable[BW]
97+ *****************
9698Workable[BW]
9799Workable[AW]
98- *****************
99100thenCombine: Workable[AW], Workable[BW]
101+ Workable[AW]
102+ *****************
100103Workable[CW]
101104anyOf
102- Workable[DW]
103105Workable[BW]
106+ Workable[DW]
104107Workable[AW]
105108*****************
106109Workable[CW]
107- Workable[DW]
108110Workable[BW]
111+ Workable[DW]
109112Workable[AW]
110113*****************
111114allOf
0 commit comments