Java 8 is an upgrade that is slated to be released in March 2014. Here we have discussed few features that we would like to see and few which we don?t want in the upcoming Java 8 update. It includes Lambda, streams, functional interfaces and others.Java 8 is an upgrade that is slated to be released in March 2014. Here we have discussed few features that we would like to see and few which we don?t want in the upcoming Java 8 update. It includes Lambda, streams, functional interfaces and others.
Java 8 is slated to be released in March 2014 but the debate has already begun over internet to what changes it will have and whether it will be favorable for Java developers or not.
This debate has made Java 8 update as the most awaited update of Java ever. The topic of discussion includes the Project Lambda, streams, functional interfaces and others.
Some of the features Java 8 might have are:
Here are few things that we might love (and would like to see) in Java 8:
Stream is a new collection that will make manipulating the data easier and faster. However, it can only be traversed once.
It is completely different from the InputStream and OutputStream of java.io package. They don't replace ArrayLists or other collections.
Streams have two modes:
Streams uses parallel mode to use the multicore processors and speed up the collection process. It is faster than for loop.
However there is a possibility that the readability can be affected with long chain of stream.
Lambda expressions are yet another feature that might be part of upcoming Java 8. Lambda expressions will allow code to be streamlined.
When a Lambda expression is written, it is changed into a functional interface during compilation. Lambda expressions will often make the code easier to read and requires less line.
Java might introduce a java.time package, which can enhance the present Java API with some more items like distances, mass and weights.
JDK 8 will build on the join framework and will have adders and accumulators.
Things that we might hate in Java 8:
This new feature will add default methods to an interface that will run directly from the interface, as they are not overridden during the implementation of interface.
Functional interface creates a default method in the interface and all the classes that implement the interface can use the Stream. An incorrect default method can be overridden in the implementer.
This can be a problem as a lot of classes that implement interfaces can still be changed using super method.
This can be a problem to most of the developers as Java 8 functional interfaces cannot get a reference to the implementing class and might allow multiple inheritance of behavior, but not state.
There is a possibility that functional interfaces will be misused.