Java 8

As you are already aware Java 8 was released a week or so back. Its one of the most awaited released of Java since long. The stand out feature in it is do with movement towards functional programming. I strongly suggest you do a bit of reading on functional programming if you have not done so yet. For your easier consumption i have provided a quick summary of changes in Java 8 here.

Interface Improvements

  • You can add ‘static’ methods to interfaces.
  • You can provide default implementation of methods in interfaces with ‘default’ keyword.
  • You can not provide default implementation for Object class methods in interfaces.
  • An interface that defines exactly one abstract method is called Functional Interface.


  • Provides a simpler syntax to instantiate functional interfaces. e.g () -> {}
  • It can also be understood as a simplified way to instantiate anonymous classes.
  • Input params and return types can be inferred. Both the braces are optional but the arrow is mandatory.
  • A lambda that access a variable or object defined outside its body is called a Capturing lambda. Such variables must be effectively final.
  • Abstract classes can not be instantiated using Lambda. It may lead to execution of hidden code, ie of the constructor (if any).


  • New package introduces concept of Stream and allows functional style operations on their values.
  • A stream is like an iterator that can be traversed once, then its used up.
  • Streams can be sequential or parallel and can be toggled between them.
  • Operations on streams are either Intermediate or Terminal. Intermediate operations allow further operations on the stream but terminal operations close the stream.
  • Intermediate operations are lazy and only a terminal operation starts processing of the stream.
  • Some stream operations are stateful as they modify the state of underlying stream.
  • Some stream operations are short circuiting as they stop any further processing on the stream.
  • Streams can be infinite but they should have a short circuiting operation.


  • New java.util.Function package introduces built in functions like Function, Consumer, Supplier etc and their variations.
  • New java.time package introduces completely new Date and Time API on lines of Joda datetime library.
  • Lot of default methods added to collection API interfaces and methods accepting functions.
  • The underlying javascript engine is rewritten completely and named Nashorn.
  • Lots of enhancements to existing classes and interfaces.

Here is the link i found best so far on java 8 –


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s