Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. @FunctionalInterface
  2. private interface myFunctionType<R> {
  3. R execute() throws Exception;
  4. }
  5.  
  6. private <T> T methodCaller(final myFunctionType<T> operation) {
  7. return operation.execute();
  8. }
  9.  
  10. public T createAnimal(int age) {}
  11. public T createLamp(String style, boolean secondHand) {}
  12.  
  13. methodCaller(() -> createAnimal(5));
  14. methodCaller(() -> createLamp("plain", true));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement