Created
November 12, 2012 17:54
-
-
Save collinvandyck/4060837 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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