Ch6 Lambdas and Functional Interfaces Flashcards
1
Q
What is a lambda expression?
A
A lambda expression is a short block of code which takes in parameters and returns a value.
2
Q
What are the rules for accessing a variable from a lambda body inside a method?
A
- Instance variable: allowed
- Static variable: allowed
- Local variable: allowed if effectively final
- Method parameter: allowed if effictively final
- Lambda parameter: allowed