Today at EclipseCon, Oracle announced the general availability of Java 8, the first major upgrade in over two years. Downloads are available for Linux and Windows as 32- or 64-bit packages, along with Mac OSX and Solaris 64-bit packages. There is also a package specifically for ARM (compiled for the Hard Float ABI) which can be used on Raspbian and other Raspberry Pi platforms.
Java 8 ships with a number of improvements and new features. These changes include:
- Lambdas provide a means to pass functions as data. With implicit casting to Single Abstract Method types (such as
Runnable
) it will dramatically simplify code that needs to pass filters and other predicates as data. (Note that the reason they are called lambdas is that Java has had closures in the form of inner classes since Java 1.1; what some incorrectly refer to as closures are really talking lambdas.) An example of a lambda isx -> x +1
. - Method References allow a static method to be referred to as a function that can be passed into a function. An example would be
Integer::parseInt
, which could be mapped to a collection of Strings to produce a collection of Integers. - Streams which provide lazy iteration of values, either from a collection, from an infinite series (such as
ThreadLocalRandom
) or from a fixed range (such as produced byIntStream
). As well as iterating over data, being able to process these in parallel and perform reductions, filtering or mapping allows these to be combined with lambdas to provide functional programming constructs in Java. - Extension methods provide a way of adding new methods to existing Java interfaces without requiring that classes implementing those interfaces be recompiled. This is used in a number of existing collections classes to provide interfaces for implementing streams and other utility references that would otherwise be in the
Collections
utility class. - JSR310 which adds new date and time processing to Java, to avoid the problems rampant in the
java.util.Date
class and related packages. - PermGen is no more; no longer will developers have to add
-XX:PermGen
to guess ahead of time how many strings will be interned in the application. - Nashorn adds native JavaScript support to the JVM, allowing Java and other JVM based languages to take advantage of JavaScript in their application.
- OpenJFX brings JavaFX to the OpenJDK, setting the stage for future IDEs to be built on this as a GUI system
As well as Java8, all the major IDE vendors announced support for Java8 on the same day, with a patch available for Eclipse 4.3.2, a minor release of IntelliJ 13.1 and a new release of NetBeans 8.0 all adding Java 8 support to their respective IDEs.
InfoQ will be following up with Oracle as part of the launch webcasts next week, and bring interviews with those behind the scenes. Stay tuned for more information.