Java 1.8 New Features

 

Following are the main features of Java 1.8

1. Lambda Expressions

2. Stream API

3. Functional Interfaces

4. Default Methods in Interfaces

5. Static Methods in Interfaces

6. Predefined Functional Interfaces like Predicate, Function, Consumer, 

Supplier.

7. Method Reference & Constructer Ref. by Double Colon (::) Operator.

8. Date & Time API (Joda API)

 

Purpose of Java 1.8

 

What is Lambda Expression?

It is an anonymous function, i.e. a function without any name, modifiers and return type and with a list of formal parameters and a body.

 

 

What is Functional Interface?

 

What is Optional?

An Optional object can have one of the following possible states:

Present: The Optional object does not represent absence.

A value is in the Optional object and it can be accessed by invoking get().

Absent: The Optional object does represent absence of a value; you

cannot access its content with get().

 

How to create an Optional object in java?