February 2014
Intermediate to advanced
160 pages
4h 59m
English
| | public static Predicate<String> checkIfStartsWith(final String letter) { |
| | return name -> name.startsWith(letter); |
| | } |
From within a lambda expression we can access variables that are in the enclosing method’s scope. For example, the variable letter in the checkIfStartsWith is accessed within the lambda expression. Lambda expressions that bind to variables in enclosing scopes are called closures.