Skip to content →

Java 8

Source: http://docs.oracle.com/javase/specs/

Recently, Oracle released a new Java version, Java 8. According to Brian Goetz (Java Language Architect), it has been in development for over 4 years and it’s development started before the launch of the former version, Java 7 [1]. This is the release with the most added features since the first Java version.

From the promises it brings, I emphasize the attempt to reduce boilerplate and error-prune code with lambda expressions, facilitate a better usage of multi-core and multi-processor systems by parallelizing tasks underneath and the ability to run JavaScript in the JVM with the built-from-scratch Oracle Nashorn engine.

It all seems great, but can I install it and run my old Java projects on it?

There are some changes in base Java objects and interfaces, such as the Collection interface. This interface contains a new method stream(). So, let’s imagine that you have an implementation of this interface in your program. What you would usually expect is that your code would not compile anymore, as you don’t have the stream() method implemented.

Java 8 introduces also a new concept, the default methods. Default methods are used to define a default action to implementations which don’t implement that method. Each new method in the base Java objects and interfaces from this release implement a default action, which allows the backward compatibility of older Java projects.

With that in mind, it should be possible to run older Java projects with the new Java release. But, you won’t be able to take the most out of it without refactoring your code.

So, what’s next?

I am starting now digging into Java 8. I expect to publish from time to time some short introductions to the novelties, with a touch of what I experience, together with some useful examples.

So, stay tuned and share your experiences!

Sources:

  1. http://www.oracle.com/events/us/en/java8/index.html
  2. R. Warburton, Java 8 Lambdas: Pragmatic Functional Programming, O’Reilly Media, 2014

Published in Java 8 Programming

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *