Lambda expressions Flashcards
1
Q
What does the test( )
method of Predicate
return?
A
A boolean.
2
Q
Do you need to specify parameter type for a lambda expression?
A
No.
But if you do, you must put them in parenthesis. Ex: foo(newArrayList( ), (List a1) -> a1.isEmpty();
3
Q
T/F: A lambda expression for a functional interface is essentially an implementation of the abstract method in the interface written in a very concise manner.
A
True.
4
Q
What pieces of the method signature can the compiler figure out on its own for a lambda expression?
A
The parameter types, return keyword and brackets.
5
Q
What is the basic syntax for a lambda expression?
A
(parameter list) OR single_variable_without_type -> { regular lines of code } OR just_an_expression_without_a_semicolon