I have seen an example in each of them, but I need to know exactly what is the difference in deep because I think I can use both of them to get the same result, So I want to know then I can choose the correct one.
What is the benefit of using each of them?
Like this example both works:
public CompletionStage<Result> getNextQueryUUID() {
return CompletableFuture.supplyAsync(() -> {
String nextId = dbRequestService.getNextRequestQueryUUID();
return ok(nextId);
}, executor);
}
public CompletableFuture<Result> getNextQueryUUID() {
return CompletableFuture.supplyAsync(() -> {
String nextId = dbRequestService.getNextRequestQueryUUID();
return ok(nextId);
}, executor);
}
This example runs in the
Play framework
.