It has been almost 20 years since the first version of Java was launched in 1996.
With the arrival of Java 5 in 2004, the programming language underwent significant changes -- especially with Generics, Enums, and Annotations.
With its 2014 incarnation, Java 8, the same scenario occurs. We now face new possibilities with the introduction of Lambda and Method References, in addition to other small changes. The Collections API, which includes the same main interfaces since 1998, went through a significant upgrade with the introduction of Streams and default methods.
In this book, you will have the chance to practice Java 8 extensively. It’s time to start programming, but first you will need to download and install the Java platform:
You can access the Java 8 API documentation here:
Eclipse supports Java 8 since the Luna (4.4) version. You will need the following update for Kepler (4.3):
Eclipse still has some minor bugs when it comes to performing more complicated inferences, but Netbeans and IntelliJ have updated their Java 8 versions.
To practice the syntax, you can choose to complete the tests and examples from the book with a simple text editor.
If you expect something on the scale of Scala, Clojure, or C#, be prepared for disappointment. Java’s legacy and relatively young age, besides its lack of value types and reification of Generics, preclude the use of certain strategies. The Java Development Team takes great care to keep the syntax simple, as to avoid obscure features that would only bring little gain. (In our view, this makes perfect sense.)
On the other hand, it is amazing what has been achieved with the release of Java 8. You might be pleasantly surprised by some of the codes and approaches used. The focus is not breaking the compatibility of legacy Java code, while being the least intrusive with regards to the older APIs. Its new feature, the
Streams, will play a crucial role in this elegant upgrade.
In order to better break down Java 8’s specifications into smaller tasks, the JEPs (JDK Enhancement Proposals) have been created -- the inspiration came from the Python community’s PEPs. You can find those in a list of proposals here:
As you can see, there are many new features in JDK8. Unfortunately, not all of these features had enough time to ripen. Among the JEPs, the Value Objects were left out:
That was also the case for the use of literals when working with Collections:
Among other ideas left out, there were several improvements to the already built-in Garbage Collectors, as well as the possible reification of Generics.
In any case, the absolute majority of the JEPs made it to the final version and were released. Throughout the book, we will see the major changes made to the language and the new APIs.
The source code for each chapter can be found here:
We recommend that you alone write all the codes presented in this book so as to practice the API and syntax. We also advise you to perform different tests from those suggested.
Here is a forum where you will be able to discuss with us or send us your suggestions or comments: