Skip to content

Instantly share code, notes, and snippets.

@shomah4a
Last active October 22, 2015 06:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shomah4a/6cbe63506c76e46b32d5 to your computer and use it in GitHub Desktop.
Save shomah4a/6cbe63506c76e46b32d5 to your computer and use it in GitHub Desktop.
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