Created
December 23, 2015 14:55
-
-
Save codeaholicguy/51bd0d7ce7be33d1222e to your computer and use it in GitHub Desktop.
This file contains 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
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; | |
} | |
@Override | |
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)); | |
System.out.println(superhero.get("doHero").call()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment