Java Reference
In-Depth Information
Version 4.1 of JDBC updated the RowSet API to version 1.1, which includes support for cre-
ating online or detached rowsets, and removed the older unsupported
com.sun.rowset
im-
plementations.
A new package,
java.lang.invoke
, was added in support of the
InvokeDynamic
JVM
changes for dynamically typed languages; it has classes such as
MethodHandle
and
CallSite
for use mainly by language developers.
Numerous small changes made to graphics rendering/fonts, Swing, networking, desktop,
I18N, and more—see
Oracle's website
.
What Is New in Java 8
Java 8 Language Changes
The biggest new feature in the Java 8 language is lambda expressions! After a decade of de-
bate on how to implement them, “closures” or “lambda expressions” arrived with Java 8.
This is such a vast topic that it gets an entire chapter in this edition; see
Chapter 9
.
Annotations can now be placed on structured types.
Java 8 API Changes
Java 8 brings in the new date/time API from JSR-310. This provides a more consistent and
sensible set of classes and routines for dealing with time.
Chapter 6
has been completely re-
written to use the new API, ending with a recipe showing various conversions between the
“old” and new APIs.
Java 8 introduced “functional programming” techniques such as closures and parallel collec-
tions, which we discuss in
Chapter 9
.
In support of
Streams
, there are new methods in interfaces such as
List
,
Map
, and
Set
,
which have been largely unchanged since the long-gone days of Java 1.1. Fortunately the
Java 8 language support adds a
default
method type in interfaces, so your custom imple-
mentations of these interfaces are not required to change (as long as you make sure you
change your IDE settings to Java 8 Compiler Compliance).
As one example of
default
methods in action,
Iterable
gets a new
default
method called
forEach()
, which lets you write code like this: