1.

What Are The Characteristics Of A Java 8 Lambda Expression?

Answer»

A lambda expression is characterized by the following syntax - PARAMETER −> expression body

Following are the important characteristics of a lambda expression −

  • Optional type DECLARATION − No need to declare the type of a parameter. The COMPILER can inference the same from the value of the parameter.
  • Optional parenthesis around parameter − No need to declare a single parameter in parenthesis. For multiple PARAMETERS, parentheses are required.
  • Optional curly braces − No need to use curly braces in expression body if the body contains a single statement.
  • Optional return keyword − The compiler automatically returns the value if the body has a single expression to return the value. Curly braces are required to indicate that expression returns a value.

A lambda expression is characterized by the following syntax - parameter −> expression body

Following are the important characteristics of a lambda expression −



Discussion

No Comment Found