Java
SE 8
The newest release of Java is
Java SE 8, with the developer’s kit being called JDK 8. It has an internal
version number of 1.8. JDK 8 represents a very significant upgrade to the Java
language because of the inclusion of a far-reaching new language feature: the lambda expression. The impact of lambda expressions will be profound,
changing both the way that programming solutions are conceptualized and how
Java code is written. As explained in detail in Chapter 15, lambda expressions
add functional programming features to Java. In the process, lambda expressions
can simplify and reduce the amount of source code needed to create certain
constructs, such as some types of anonymous classes. The addition of lambda
expressions also causes a new operator (the –>) and a new syntax element to
be added to the language. Lambda expressions help ensure that Java will remain
the vibrant, nimble language that users have come to expect.
The
inclusion of lambda expressions has also had a wide-ranging effect on the Java
libraries, with new features being added to take advantage of them. One of the
most important is the new stream API, which is packaged in java.util.stream. The stream API supports pipeline operations on
data and is optimized for lambda expressions. Another very important new
package is java.util.function. It
defines a number of functional interfaces,
which provide additional support for lambda expressions. Other new
lambda-related features are found throughout the API library.
Another
lambda-inspired feature affects interface.
Beginning with JDK 8, it is now possible to define a default implementation for
a method specified by an interface. If no implementation for a default method
is created, then the default defined by the interface is used. This feature
enables interfaces to be gracefully evolved over time because a new method can
be added to an interface without breaking existing code. It can also streamline
the implementation of an interface when the defaults are appropriate. Other new
features in JDK 8 include a new time and date API, type annotations, and the
ability to use parallel processing when sorting an array, among others. JDK 8
also bundles support for JavaFX 8, the latest version of Java’s new GUI
application framework. JavaFX is expected to soon play an important part in
nearly all Java applications, ultimately replacing Swing for most GUI-based
projects. Part IV of this book provides an introduction to it.
In the
final analysis, Java SE 8 is a major release that profoundly expands the
capabilities of the language and changes the way that Java code is written. Its
effects will be felt throughout the Java universe and for years to come. It truly
is that important of a upgrade.
The
material in this book has been updated to reflect Java SE 8, with many new
features, updates, and additions indicated throughout.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.