Java 8 Features

“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 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.

This Java tutorial was added on 20/04/2014.

Comments on "Java 8 Features" Tutorial:

  1. Pon Siva says:

    Thank you for sharing this.

  2. Shivang Gupta says:

    Thanks. Looking forward to the articles in detail! :)

  3. Joe says:

    Welcome Shivang, you will get them soon :-)

  4. Mallikarjun says:

    Didn’t know that Java8 is released till your mail landed on my mailbox. Thanks for updates. Waiting for more info on Lambda.

  5. vijendra singh says:

    Thanks alot :)

  6. Joe says:

    Welcome Vijendra.

  7. Joe says:

    Earlier, I have written couple of tutorials on Java Lambda Expressions. These tutorials will help you to get started with Lambdas in Java 8.

    http://javapapers.com/core-java/lambda-expression-in-java-8/
    http://javapapers.com/core-java/java-lambda-expression-examples/

  8. Gootam says:

    Good Work Joe… Keep it up

  9. Ketan says:

    Great overview Joe !

  10. Deepak says:

    Good one :)

  11. Andy says:

    I’m curious what IDE are You using to check out Java 8 new features?

  12. Joe says:

    Thanks Deepak.

  13. Gopinathan K M says:

    Dear Joe

    It looks Java is fast picking up with Clojure, another JVM langauge. If Oracle has n’t done this at this stage Java would have left with as it was with earlier EJB versions. All these are in Clojure. By this Lambda act Java is both object oriented and functional language.

    Thanks Joe for the updates.

    With Regards

    Gopinathan K M

  14. Rakesh says:

    Thanks Joe!!

    It was said that PermGen space was completely removed and replaced with system memory, Then doesn’t it affect the system performace(Objects may not be garbage collected) and we cannot find out memory leaks too.

  15. Roshan says:

    Thanks Joe very helpful.I really appreciate your passion for Java keep the good work.

  16. Firoz Shaikh says:

    Love It!

  17. Pratik says:

    Thanks Joe , I have downloaded jdk 8 will start experimenting soon.
    I love lambda feature a lot.

  18. Joe says:

    I am using Eclipse IDE to develop using Java 8.

    You may download the latest Eclipse and it comes default with support for Java SE 8. If you are using Eclipse Kepler, you need to install a patch and it can be found at

    https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler

  19. Joe says:

    No it will not affect the performance. I am working on a performance bench mark using Java 8 and Java 7. I will post that article soon.

  20. Joe says:

    Thanks Firoz.

  21. Joe says:

    Great Pratik. Post your experiences on Java 8 features.

  22. […] is one of the core features of Java 8. It can be used in two different modes command-line and embedded in Java applications. Generally […]

  23. Panada suraj says:

    Hello Sir,I am a student studied in Hyderabad.
    I Listen that the code name of Java8 is SPIDER.
    Thank You..

  24. Panada suraj says:

    Hello sir,My name is Panada Suraj.I am a student,studied in Hyderabad.
    I Listen that the code name of Java8 is “SPIDER”.
    Thank You.

  25. Kalai says:

    Superb Joe..

  26. […] This Java tutorial is to give an introduction to the Stream API which is one of the core features of Java 8. […]

  27. Arindam says:

    Nice share.Keep it up.

  28. Abhijith says:

    Hi Joe,

    PermGen Space is not part of Java SE 8 specification. Metaspace is an improvement/enhancement to HotSpot JVM.

    PermGen was long removed by other JVMs like Oracle JRockIt and IBM JVMs.

    I thought, it would be better to differentiate the language changes, which is common to Java language and JVM changes which are specific to the provider.

  29. Jiten says:

    Default methods gives the ability to add default implementation for methods in an interface.

    So, can i say that from now we don’t requires to use abstract class.??

    is it like option or replacement to abstract class ?

  30. Subhash Panchani says:

    Thank you for sharing Java 8 features, but i want to know which are the important features among these that can be useful in our daily development for web application.

  31. […] Update: Permanent Generation (Permgen) space is removed from Java SE 8 features. […]

  32. […] memory by removing duplicate String values to a single char[] array. This option is introduced in Java 8 u […]

  33. aakash says:

    Nice.Keep it up.

  34. […] to Java 8 features, Android 5 brings in mammoth set of classes and lot of whole new packages. This will open up […]

Comments are closed for this "Java 8 Features" tutorial.