Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FunctionalInterface
- private interface myFunctionType<R> {
- R execute() throws Exception;
- }
- private <T> T methodCaller(final myFunctionType<T> operation) {
- return operation.execute();
- }
- public T createAnimal(int age) {}
- public T createLamp(String style, boolean secondHand) {}
- methodCaller(() -> createAnimal(5));
- methodCaller(() -> createLamp("plain", true));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement