Java Platform, Standard Edition 8 (Java SE 8)” is released on 18th March 2014. Along with the Java SE 8 platform, the product that implements the platform, “Java SE Development Kit 8 (JDK 8)” and “Java SE Runtime Environment 8 (JRE 8)” is also released and available for download. From this release, the code name custom is discontinued and so no official code name for Java 8.

Java SE 8 is one of the most feature packed release in the Java history. In this article, let us go through the highlights of the core features of Java 8. Following list is a highlight of important features, there are other minor enhancements, security features, bug fixes are available as part of Java 8.


  1. Lambda Expressions
  2. Pipelines and Streams
  3. Date and Time API
  4. Default Methods
  5. Type Annotations
  6. Nashorn JavaScript Engine
  7. Concurrent Accumulators
  8. Parallel operations
  9. PermGen Space Removed
  10. TLS SNI
  1. Lambda Expressions

    Lambda expressions gives the ability to pass a functionality as a method argument. Lambda expression help us reduce the code clutter in using a single method class. For example, when we have to associate an action button click to a functionality, then lambda expressions will make the code look neat and compact. Refer Java Lambda expression examples to learn more.
  2. Pipelines and Streams

    Pipelines and streams enrich the Java collections framework. Sequence of aggregate operations is a pipeline. Stream is used to propagate elements from a source through a pipeline. It is a sequence of elements. Pipeline and streams will make our task easier in accessing the elements from collections and applying operations on it.
  3. Date and Time API

    Pre Java 8, date and time related operations are little bit cumbersome. JSR 310: Date and Time API give us a brand new package java.time package. This is a well thought package. It contains a best list of utility methods used for regular operations. This will help in handling date and time operations in an easier way.
  4. Default Methods

    Default methods gives the ability to add default implementation for methods in an interface. This is a rocking feature of Java 8. When we implement an interface, if we did not provide implementation for a method, then the default method will be used in that place. This will help in maintaining backward compatibility in applications, we can add a method to an interface without breaking its implementations.
  5. Type Annotations

    Before Java 8 Java annotations can be applied to type declarations. From this Java 8 release onwards, annotations can be applied to type use. Annotations can be applied wherever a type is used like in new instance creates, exception throws clause etc. This will help to enforce stronger type checks and using this feature we can come up with a type checking framework itself.
  6. Nashorn JavaScript Engine

    Nashorn is a brand new JavaScript engine provided along with the Java 8 release. Using this we can develop standalone JavaScript applications in Java. Pre Java 8, we got JDK with a JavaScript engine based on Rhino. It is a developed from scratch. It will provide better compatibility with ECMA normalized JavaScript specification and better performance than Rhino. Already we have seen a tutorial to run Javascript in Java using the ScriptEngineManager.
  7. Concurrent Accumulators

    java.util.concurrent.atomic package is getting additional classes as part of Java 8 release. These will help to sum values from across multiple threads.
  8. Parallel operations

    Iterating over a collection can be done in parallel using the aggregate operations easily. Pre Java 8 Iterators are used to parse the elements of a collection one by on explicitly. Now that can be done in parallel internally with the use of streams and aggregate operations. We can create multiple substreams and those substreams can be processed internally in parallel and then the results be combined. For this to be effective, we need to have multiple cores and data volume.
  9. PermGen Space Removed

    The PermGen space is removed from Java 8 and instead we have MetaSpace introduced. One of the most dreaded error, “java.lang.OutOfMemoryError: PermGen error” will no longer be seen from Java 8. Nice thing is that the MetaSpace default is unlimited and that the system memory itself becomes the memory.
  10. TLS SNI

    Server Name Indentification (SNI) is an extension of the TLS protocol used for identifying the certificate to serve based on the hostname specified by the client. This enables a server to have virtual host over HTTPS. The same IP address can be used for multiple hosts and their respective different security certificates.
The above list of Java 8 features is just a highlight. I will be writing detailed tutorials about each of them in the coming days.


0 comments :

Post a Comment

 
Top