code_junkie

Closures in Java 7

Nov 11th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. boolean even = { int x => x % 2 == 0 }.invoke(15);
  2.  
  3. {int => boolean} evaluateInt; //declare variable of "function" type
  4. evaluateInt = {int x => x % 2 }; //assignment
Add Comment
Please, Sign In to add comment