Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//fetch something from A to make a lookup on B
ADao adao = new ADao();
CompletableFuture<A> aFutureLoaded = adao.findByIdAsync(123);
BDao bdao = new BDao();
aFutureLoaded.thenCompose(
a->bdao.findBySomeAValueAsync(a.getSomeAValue());
).whenComplete((bResult,ex)->{
if(ex==null){
//do something with the result
}else{
//oops something went wrong
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment