06 January 2021

Lambda Expression

  • Java lambda expression is treated as a function, so compiler does not create .class file.
  • It helps to iterate, filter and extract data from collection.
  • Lambda expression provides implementation of functional interface which has functional Interface.
  • An interface which has only one abstract method is called declare an interface as functional interface.
  • @FunctionalInterface, which is used to declare an interface as functional interface.
  • (argument-list) -> {body}

    • Argument-list: It can be empty or non-empty as well.
    • Arrow-token: It is used to link arguments-list and body of expression.
    • Body: It contains expressions and statements for lambda expression.

No comments:

Post a Comment

Most views on this month