Java 8 Features

Oracle released a new version of Java as Java 8 in March 18, 2014. It was a revolutionary release of the Java for software development platform. It includes various upgrades to the Java programming, JVM, Tools and libraries.

Java 8 Features

Oracle released a new version of Java as Java 8 in March 18, 2014. It was a revolutionary release of the Java for software development platform. It includes various upgrades to the Java programming, JVM, Tools and libraries.

Java 8 Programming Language Enhancements

Java 8 provides following features for Java Programming:

  • Lambda expressions,

  • Method references,

  • Functional interfaces,

  • Stream API,

  • Default methods,

  • Base64 Encode Decode,

  • Static methods in interface,

  • Optional class,

  • Collectors class,

  • ForEach() method,

  • Parallel array sorting,

  • Nashorn JavaScript Engine,

  • Parallel Array Sorting,

  • Type and Repating Annotations,

  • IO Enhancements,

  • Concurrency Enhancements,

  • JDBC Enhancements etc.

Lambda Expressions

Lambda expression helps us to write our code in functional style. It provides a clear and concise way to implement SAM interface(Single Abstract Method) by using an expression. It is very useful in collection library in which it helps to iterate, filter and extract data.

Optional

Java introduced a new class Optional in Java 8. It is a public final class which is used to deal with NullPointerException in Java application. We must import java.util package to use this class. It provides methods to check the presence of value for particular variable.

Stream API

Java 8 java.util.stream package consists of classes, interfaces and an enum to allow functional-style operations on the elements. It performs lazy computation. So, it executes only when it requires.

Functional Interface

An Interface that contains only one abstract method is known as functional interface. It can have any number of default and static methods. It can also declare methods of object class.

Functional interfaces are also known as Single Abstract Method Interfaces (SAM Interfaces).

blog

copyright©2020 Full Stack Developer - Kripesh Bista all rights reserved