Thursday, July 8, 2021

What is Lambda expression and it's used ?

 In this article, we will discuss the most important features in Java 8 Lambda expression.




First, We will discuss Lambda expression and then we will discuss its use in programming.

What is Lambda expression ?

Lambda expression is an anonymous function.  In other word's, It's short block of code which is takes parameter and return value. By using lambda expression, we can write more readable, maintainable and concise code. It's enable functional programing in Java. 


New Features in Java 8

 In this  article, we will discuss new features in Java 8 version




Following are the features which came in Java 8 version.

  1. Lambda expression: Lambda expression is an anonymous function. In other words, Lambda expression is a block of code which takes some input parameter and return values.
  2. default and static method in the interface: default and static methods came in the interface.
  3. functional interface: Functional interface should contain only one abstract method and it may contain multiple default and static methods. It's used to invoke a lambda expression.
  4. Stream API
  5. Date and Time API
  6. Double colon (::) for method reference and constructor reference
  7. Optional class

What is the difference between HashMap and Hashtable ?

In this article, we will discuss the most popular interview question in the Collection framework.



  1. HashMap allows one null key and multiple null values. But in another way Hashtable is not allowed null key or values.
  2. HashMap is non-synchronized means It does not contain any synchronized method. Hashtable is synchronized.
  3. HashMap performance-wise is good as compare to Hashtable.
  4. HashMap is used array and Linked-List for storing the key and values. Hashtable is used a hashtable data structure.
  5. HashMap is useful in a non-multithreaded environment and Hashtable is useful in a multithreaded environment







What is Lambda expression and it's used ?

  In this article, we will discuss the most important features in Java 8 Lambda expression. First, We will discuss Lambda expression and the...