varargs :
interface Invokable extends FunctionalInterface {
Object invoke(Object... arguments);
}
, (int β Integer, long β Long ..).
cast .
Object, , :
interface Argument<R> {
}
interface Invokable<R, A extends Argument<R>> extends FunctionalInterface {
R invoke(A argument);
}
foo, . :
private <A, R> R foo(A arg) {
if (arg != null) {
final Invokable<A, R> invokable = invokables.get(a.getClass());
try {
return invokable.invoke(arg);
} catch (InterruptedException e) {
}
}
return null;
}
.