-
- Significant reason for introducing java 8 was to introduce conciseness in the code.
- Java 8 Brings the functional programming which enabled by lambda expressions(a powerful tool to create concise code base).
- If you ever observed/heard, With Python,Scala we can do the same things in very less LOC. By mid 20s Java lost a large market due to these languages. To prevent further loss java upgraded itself from only OOPs language to some concepts of FP to create concise code base.
-
- Lambda expressions
- Functional interface
- Stream API
- Default Methods in the interface
- Static methods
- Optional class
- Method references
- Date API
- Nashorn JavaScript Engine
-
- Compact Code
- More readable and reusable code
- More testable code
- Parellel operations
-
- Lambda expression is an anonymous function(Without name,return type and access modifiers and having one lambda(->))
-
- Normal programming Technique
public int add(int a ,int b){ return(a+b); } -
Equivalent Lambda Expressions
<pre> <code> (a,b)-> (a+b); </code> </pre> </li> </ol>
- Normal programming Technique