Sunday 27 October 2013

Exciting features of Java 8

Java 8 is scheduled to be released in Q1 next year. It looks really promising with many exciting features such as uniform platform, Lambda, enhancement of core libraries with Lambda, new Date and Time API, compact profiles, Nashorn JavaScript Engine and many more. These new features in Java will bring a paradigm shift by providing many great possibilities of writing good, concise and elegant code.

In Java 8 we are going to see the platform unification in terms of code portability, commonality of APIs, common tooling. Nandini Ramani, VP of Java Development of Java Platform for Oracle in her keynote speech in JavaOne Strategy Keynote 9-22-2013 mentioned that Java 8 will focus on bringing together different implementations of Java under one platform. Language features of Java SE 8 and Java ME 8 will be similar. Peter Utzschneider, VP of Java Product Management for Oracle also mentioned in that talk that there will one type of Java Developer in future. Beyond Java 8, Java SE will be shrink enough to work on embedded and mobile devices.

Lambda is the another most exciting feature of Java 8, bringing closures to Java. As per Mark Reinhold, Chief Architect of the Java Platform Group:

Lambda is the single largest upgrade to the programming model. Ever. It's larger even than Generics. It's the first time since the beginning of Java that we've done a carefully coordinated co-evolution of the virtual machine, the language and the libraries, all together. Yet the result still feels like Java.

Lambda will reduce lot of boilerplate code, make the code concise and easy to understand. Core libraries of Java are enhanced by Lambda.

There will be new date/time API in Java 8. All the classes in java.time package are immutable and thread-safe. The date and time types include Instant, LocalDate, LocalTime, LocalDateTime and ZonedDateTime. There are also the Duration and Period types and additional value types include Month, DayOfWeek, Year, Month, YearMonth, MonthDay, OffsetTime and OffsetDateTime.

Compact profile of Java 8 will allow applications to use a subset of Java SE to run on resource-constrained devices. For example: an application that does not use the Swing/AWT/2D graphics stack can achieve considerable space savings by running on top of a Profile that does not include those APIs. Compact profile replaces CDC.

Nashorn is the new, lightweight, high-performance implementation of JavaScript integrated into the JDK. Nashorn is the successor to Rhino, with improved performance and memory usage. Nashorn will be made available to Java applications via the existing javax.script API. It will define a new command-line tool, jjs.

There are many other features, bug fixes and performance improvement in Java 8. Features list of Java 8 is available here. Java 8 Developer Preview is released and can be downloadable from here.

No comments:

Post a Comment