Skip to content

Instantly share code, notes, and snippets.

@HennIdan
Last active May 29, 2016 13:44
Show Gist options
  • Save HennIdan/e2ca38c917db510f4a5ac52b3e6c7071 to your computer and use it in GitHub Desktop.
Save HennIdan/e2ca38c917db510f4a5ac52b3e6c7071 to your computer and use it in GitHub Desktop.
Future <String> marvel = executor.submit(new Callable <String> () {
public String call() {
return getMarvelHeroWithCharacter(“C”); // totally not making this up
}
});
// other very important stuff of course, non-blocking ftw
System.out.println(marvel.get()); // this bit is blocking if the result isn’t ready yet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment