Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public static class MyFunction implements Callable<Integer> {
private int a;
private int b;
public MyFunction(int a, int b) {
this.a = a;
this.b = b;
public Integer call() throws Exception {
return this.a + this.b;
public static void main(String... args) throws Exception {
Map<String, Callable> superhero = new HashMap<>();
superhero.put("doHero", new MyFunction(3, 5));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment