Last active
October 22, 2015 06:50
-
-
Save shomah4a/6cbe63506c76e46b32d5 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
import java.io.IOException; | |
import java.rmi.activation.ActivationException; | |
class Hoge { | |
static interface Function<T, E extends Throwable> { | |
public void apply(T hoge) throws E; | |
} | |
private static <T, E extends Throwable> void test(Function<T, E> f, T value) throws E { | |
f.apply(value); | |
} | |
private static void func(Integer hoge) throws IOException, ActivationException { | |
System.out.println(hoge); | |
} | |
private static void func2(Integer hoge) { | |
System.out.println(hoge); | |
} | |
public static void main(String[] args) { | |
try { | |
test(Hoge::func, 100); | |
} catch (Exception e) { | |
System.out.println(e); | |
} | |
test(Hoge::func2, 100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment