November 2017
Intermediate to advanced
398 pages
10h 14m
English
One of the great advantages of CompletableFuture is that it can be passed around as an object and used several times to start different chains of operations. To demonstrate this capability, let's create several new operations:
String getData() { System.out.println("Getting data from some source..."); sleepSec(1); return "Some input";}SomeClass doSomething(String input) { System.out.println( "Doing something and returning SomeClass object..."); sleepSec(1); return new SomeClass();}AnotherClass doMore(SomeClass input) { System.out.println("Doing more of something and " + "returning AnotherClass object..."); sleepSec(1); return new AnotherClass();}YetAnotherClass doSomethingElse(AnotherClass input) ...
Read now
Unlock full access