Java 8 Lambdas Set the Tone for New Development

 
 
By Darryl K. Taft  |  Posted 2014-03-18 Email Print this article Print
 
 
 
 
 
 
 

Oracle announced the availability of Java 8 with support for lambda expressions, which is one of the biggest additions to the language in years.

Oracle announced the general availability Java Platform, Standard Edition 8 (Java SE 8), a major feature release of the Java platform.

This release has been much anticipated as it was delayed while Oracle took time to secure the platform and work on other features. In fact, Java 8 is the first major release of Java since July 2011 when Oracle delivered Java 7. In addition to Java SE 8, Oracle also has made available the Java Developer Kit 8 (JDK 8) and the Java SE 8 Runtime Environment (JRE 8).

Java 8 includes a slew of new features and enhancements, including enhanced developer productivity and significant application performance increases through reduced boilerplate code, improved collections and annotations, simpler parallel programming models and more efficient use of modern, multi-core processors.

Perhaps the biggest new feature in the Java 8 is support for Lambda expressions. Lambda expressions represent a new language feature introduced in Java SE 8. Lambdas enable developers to treat functions as method arguments or code as data. Lambda expressions let you express instances of single-method interfaces -- referred to as functional interfaces -- more compactly. Method references provide easy-to-read lambda expressions for methods that already have a name.

“Java SE 8 is about taking advantage of new parallel architectures,” said Al Hilwa, an analyst with IDC. “Lambda, the key feature, opens the door for a new style of development that can lead to more parallelism and other capabilities like the Streams API are about parallel processing as well. The changes are significant for the community and for improving code quality everywhere in the long run.”

Regarding the new Stream API, classes in the new java.util.stream package provide a Stream API to support functional-style operations such as Filter/Map/Reduce on streams of elements. The Stream API is integrated into the Collections API, which enables bulk operations on collections, such as sequential or parallel map-reduce transformations.

“Java 8's lambdas look awesome,” said Charles Nutter, a core contributor to JRuby, which is an implementation of the Ruby language on the JVM. He added that the new support for lambda expressions is “as big a deal for Java the language as invokedynamic was for the VM.” The invokedynamic instruction simplifies and potentially improves implementations of compilers and runtime systems for dynamic languages on the JVM. In other words, it enables dynamic languages to run on the Java Virtual Machine.

“Java has never tried to minimize your loc count,” said Matti Tahvonen, a developer at Vaadin, in a blog post on Java 8. “With good typing and nice code completions in IDEs, you don’t really need to minimize the amount of code you write. Maintainability and readability is commonly way more important than the amount of code. Still even, hardest Java fanatics have to confess that lots of keywords and symbols don’t necessary improve your code quality. Lambda support is one of the most visible enhancements in Java 8. In Vaadin developers’ daily work, lambdas mean a cleaner syntax for inline event listeners: any single method interface can now be expressed with a shorter lambda expression. From a library developers POI, this is a great change. Most commonly there are no changes needed to the libraries. Let me repeat myself: most core Vaadin API’s and add-ons can take advantage of lambdas today.”

Earlier this month, Typesafe, the company behind Scala, a functional programming language based on Java, released the results of a survey of more than 2,800 developers, where that 83 percent of respondents chose lambda expressions as their favorite feature of Java 8. The second most popular response was the improvements to the collections that are being added to exploit lambdas.

The Typesafe study also indicated that 65 percent of Java developers have plans to upgrade to Java 8 within the next 24 months, 54 percent plan to upgrade within the next 12 months, 29 percent plan to upgrade within the next six months, and only 1 percent of Java developers who have evaluated Java 8 have decided not to upgrade for the foreseeable future.

"This interesting snapshot of a sizable number of survey respondents suggests not only an intent to upgrade to Java 8 relatively quickly, but real interest in the new functional programming features it brings," said Stephen O'Grady, principal analyst with RedMonk. "Such a transition to mainstream adoption would be typical of enterprise adoption patterns, which require technologies to prove themselves in high scale environments first."



 
 
 
 
 
 
 
 
 
 
 
 
 

Submit a Comment

Loading Comments...
 
Manage your Newsletters: Login   Register My Newsletters























 
 
 
 
 
 
 
 
 
 
 
Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel