Connect with us

CORE JAVA

Java 8 Features With Example

new features java 8

Agenda for this blog is to explore Java 8 features which was a big update that changed the way developer writes code. It helps developer to write clean and concise code, improved abstraction and enhance their productivity. Lets start with a brief introduction of each update which was added in java 1.8 and then go deepr to undertand the concept along with the code example. 

1: Lambda Expression (λ)

The Main Objective of Lambda Expression is to bring benefits of functional programming into Java.  Lambda expressions are similar to methods but without name.

👉Lambda Expression is just an anonymous (nameless) function. That means the function which doesn’t have the name, return type and access modifiers.

 👉Lambda Expression also known as anonymous functions or closures.

2: Functional Interfaces

An interface that contains only one abstract method is known as Functional Interface. Because, exactly only one abstract method is mandatary to mark an Interface as as a Functional Interface & due to this naure it is also known as a Single Abstract Method interface (SAM).

3: Default methods in Interface

4: Predicates

Predicate is a functional interface which represents  a boolean-valued function of one argument and present in java.util.function. It is used to test objects whether they satisfy certain conditions or not (true or false).

5: Consumer

6: Functions

7: Double Colon( : : ) Operator

8: Stream API

9: Date and Time API

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in CORE JAVA