8 features of java 8

JAVA 8 or JDK 1.8 is a major release of JAVA language. Its initial version was released on 18 March 2014. With the Java 8 release, Java provided support for functional programming, new JavaScript engine, new APIs for date time manipulation, new streaming API and many more.


8 New Features of Java 8

The most significant features of java 8 are below:

Lambda expression: 

It adds functional processing capability to Java. A new language feature, has been introduced in this release. They enable you to treat functionality as a method argument, or code as data. Lambda expressions let you express instances of single-method interfaces (referred to as functional interfaces) more compactly.

Method references: 

Referencing functions by their names instead of invoking them directly. Using functions as parameter. Provide easy-to-read lambda expressions

Default method: 

Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces.


Stream API: 

New Stream API (java.util.stream ) to support functional-style operations on streams of elements. The Stream API is integrated into the Collections API, which enables bulk operations on collections, such as sequential or parallel map-reduce transformations.

Date Time API: 

The Date/Time API is moved to java.time package and Joda time format is followed. Another good news is that, most classes are Thread safe and immutable.

Nashorn, JavaScript Engine: 

A Java-based engine to execute JavaScript code. It is similar to the V8 engine provided by chrome over which Node.js runs. It is compatible with Node.js applications while also allowing actual Java libraries to be called by the javascript code running on server. This is exciting to say at the least as it marries scalability and asynchronous nature of Node.js with safe and widespread server side Java middleware directly.

New tools:

New compiler tools and utilities are added like ‘jdeps’ to figure out dependencies.

Optional Values:

Emphasis on best practices to handle null values properly. Java SE 8 introduces a new class called java.util.Optional that can alleviate some of these problems.

References: 
http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html

Older Posts

naeemgik. Powered by Blogger.