JavaOne 2013 – Mark Reinhold explains Lambda in Java Technical keynote

One of the highlights for me of JavaOne was the technical keynote. I found especially useful the explanation by Mark Reinhold of Lambda (I finally get it!). So I have reproduced his slides here with my thoughts. (Apologies that some of my photos are slightly out of focus).

TWO key objects of Java is readability and abstraction (both allowing the portability of code and giving the JVM the opportunity to make optimisations including using parallel cores). Lambda gives both. It is also the revolutionary feature in Java 8.

Traditional Java code can be fairly verbose. This code to remove all adults from a group needs an iterator and a loop.

Traditional Java code

We can improve the layout by using Interfaces but we still end up with overly complex code.

Wouldn’t it be nice if we could rewrite it like this! The code is much clearly and more closely resembles the problem it is solving. And the JVM can optimise if possible across multiple cores.

Lambda code

 

And we can do complex comparisons easily.

highest weight

 

Another comparison shows just come much cleaner the Lambda code is (and how much easier it is to read the code).

Verbose Java code

 

Try and guess what the code does from the example above and then look at the lambda implementation

Lambda version

 

Lambda also introduces this concept of streams and makes some major changes to Collections. Several of the major language changes are to preserve backwards compatibility, such as default implementations for methods (allowing retrofitting of code onto existing libraries). Lambda also avoids lots of object creation in its processing steps.

So there you have a description of Lambdas. My definition of an excellent teacher is someone who makes the most complex things seem obvious and Mark Reinhold definitely achieved that…

If you want more information on JavaOne 2013 and further coverage of the entire event check out our JavaOne 2013 Series Index, which covers everything that is happening and is constantly updated, keep checking back for new info!

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the Blog RSS.

 

Ebook Page Link

The following two tabs change content below.

Mark Stephens

System Architect and Lead Developer at IDRSolutions
Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Related Posts:

  • No Related Posts
Markee174

About Mark Stephens

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>