Guest User

Untitled

a guest
Jan 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. package de.tdlabs.training.golf;
  2.  
  3. import static java.util.Arrays.asList;
  4.  
  5. import java.util.ArrayList;
  6. import java.util.function.Consumer;
  7.  
  8. public class PseudoLocalTypeInferenceExample {
  9.  
  10. public static void main(String[] args) {
  11.  
  12. capture(new ArrayList<String>(asList("1", "2", "3")) {
  13. public int tenSize() {
  14. return 10 * size();
  15. }
  16. }).accept(l -> System.out.println(l.tenSize()));
  17.  
  18. }
  19.  
  20. public static <T> Consumer<Consumer<T>> capture(T instance) {
  21. return c -> c.accept(instance);
  22. }
  23. }
Add Comment
Please, Sign In to add comment