Skip to content

Instantly share code, notes, and snippets.

@fromdev
Created August 15, 2019 02:44
Show Gist options
  • Save fromdev/6fd0d8b448e9c8dfb805ab872936c605 to your computer and use it in GitHub Desktop.
Save fromdev/6fd0d8b448e9c8dfb805ab872936c605 to your computer and use it in GitHub Desktop.
SampleAsyncCall - Supplier Lambda Example Code
MyClass myobject = new MyClass();
CompletableFuture<Data> dataCompletableFuture = CompletableFuture.supplyAsync(() -> myobject.getData()); // this is async call with supplier Lambda
Data dataObject = dataCompletableFuture.get(); // this is a blocking call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment