Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Java Lambdas

You're reading from   Learning Java Lambdas An in-depth look at one of the most important features of modern Java

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher
ISBN-13 9781787282087
Length 114 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Toby Weston Toby Weston
Author Profile Icon Toby Weston
Toby Weston
Arrow right icon
View More author details
Toc

Lambdas vs closures


The terms closure and lambda are often used interchangeably but they are actually distinct. In this section we'll take a look at the differences so you can be clear about which is which.

Below is a table showing the release dates for each major version of Java. Java 5.0 came along in 2004 and included the first major language changes including things like generics support:

Around 2008 to 2010 there was a lot of work going on to introduce closures to Java. It was due to go in to Java 7 but didn't quite make it in time. Instead it evolved into lambda support in Java 8. Unfortunately, around that time, people used the term "closures" and "lambdas" interchangeably and so it's been a little confusing for the Java community since. In fact, there's still a project page on the OpenJDK site for closures and one for lambdas.

From the OpenJDK project's perspective, they really should have been using "lambda" consistently from the start. In fact, the OpenJDK got it so wrong, they...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime