Skip to content

Instantly share code, notes, and snippets.

@collinvandyck
Created November 12, 2012 17:54
Show Gist options
  • Select an option

  • Save collinvandyck/4060837 to your computer and use it in GitHub Desktop.

Select an option

Save collinvandyck/4060837 to your computer and use it in GitHub Desktop.
// we want a return value here.
int i = wrap(new Callable<Integer>() {
public Integer call() {
return 42;
}
})
// if we don't have a return value, we're forced to return null
wrap(new Callable<Void>() {
public Void call() {
// do stuff
return null;
}
})
// ah, much better.
wrap(Executors.callable(new Runnable() {
public void run() {
// do stuff
}
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment